Tuesday, October 25, 2016

Why .net cant become a platform independent language

The CLI (Common Language Infrastructure) is a standard, and as such it is designed to be
mostly platform-independent. Here, platform refers to the underlying computer architecture, including
the operating system.

.NET is Microsoft's principal implementation of the CLI and runs only on Windows systems. Therefore,
.NET is not platform-independent.

Mono is also an implementation of the CLI, but one designed to work on different platforms such as Linux
and Windows. Mono is definitely more platform-independent than .NET.

Why does .NET generate two web.config files in an MVC asp.net application?

Why does .NET generate two web.config files in an MVC asp.net application?
----------
I'd like to add to this that the Web.Config in the /Views folder is a great (if not thé) way to declare namespaces specifically for your views in. In a web application it is very possible almost every view gets a ViewModel (instead of your actual model) passed to it. Declaring the full namespace after @model or having the same @using App.Web.Viewmodels gets tedious. This way, all viewmodels are automatically available and you have to do extra work to get the real models in scope, which should then set of some alarm bells immediatly.

Also, usually an application can get a lot of extension-methods specifically for use in the view (the HTML-helper jumps into mind). It makes sense to define the namespace to this extension class in the /Views/Web.Config. That way you never wonder "Why cant IntelliSense find the @Html.ImageLink() method??!"
-----------------
You can have multiple configuration files in your project at the same level too. We do it like this. We have one main configuration file (Web.Config), then we have two more configurations files. App.Config and Database.Config. in App.Config we defined all the application level settings. in Database.Config we define all the database level settings. And in Web.Config we refer App.Config and Database.Config like this:

 <appSettings configSource="app.config">
 </appSettings>
 <connectionStrings configSource="database.config">
 </connectionStrings>
Also , you can have multiple web.config files in sub directories. Settings will be override automatically by asp.net.