Wednesday, November 29, 2017

What's new in .Net Core 2.0

New  featured in NET Core 2.0

• Fastest version of .NET ever

• More APIs

• More project templates

• More distros

• Simplified packaging

• New and improved Visual Studio tooling

• Visual Studio for Mac support

Has much bigger API surface

Extended to cover intersection between .NET Framework and Xamarin

Also makes .NET Core 2.0 bigger as it implements .NET Standard 2.0

+20K More APIs than .NET Standard I.x

Can reference .NET Framework libraries

Compatibility shim allows referencing existing .NET Framework binaries

No recompile required — also covers existing NuGet packages 

Limited to libraries that only use APIs that are available for .NET Standard

~70% of NuGet packages are API compatible 

Tuesday, November 28, 2017

Choosing between .NET Core and .NET Framework for server apps

Use .NET Core for your server application when:
  • You have cross-platform needs.
  • You are targeting microservices.
  • You are using Docker containers.
  • You need high-performance and scalable systems.
  • You need side-by-side .NET versions per application.
  • Are not afraid of breaking and fixing things since ASP.NET Core is not fully matured yet.
Use .NET Framework for your server application when:
  • Your app currently uses .NET Framework (recommendation is to extend instead of migrating).
  • Your app uses third-party .NET libraries or NuGet packages not available for .NET Core.
  • Your app uses .NET technologies that aren't available for .NET Core.
  • Your app uses a platform that doesn’t support .NET Core.
 Jeff Fritz from Microsoft writes in his article, Should I Use ASP.NET Core or MVC 5:
“Both frameworks will still be supported in at least 4 years. Both frameworks have an MVC approach to coding and both use a very similar Razor templating language.”
The following table is a list of key takeaways from Jeff’s article:
 Stable framework
 Raw performance
 Tested and proven for a decade
 Leading edge, continuous learning, and upgrades
 Target multiple operating systems
 Windows container model support
 Share components across various platforms – Web server, Mac, iOS, Android, XBox, Windows Mobile, Windows desktop, Unity
 .NET Standard with either.

Porting ASP.NET MVC to ASP.NET Core
The following document lists the process and tools of migrating your existing ASP.NET MVC project to ASP.NET Core.

Sunday, March 9, 2014

how many types of triggers are there in SQL

There are mainily 3 types of triggers

  1. DML trigger
  2. Instead of trigger written on only view
  3. System trigger
DML trigger written on table that gets fired on dml events like insert or delete or update operation
that trigger may fire 
  1. After DML event 
  2. Before DML event these are timings for trigger firing
Instead of trigger written only on view that view is not modifiable that also gets fired when DML event occurs
System trigger gets fired on system event like before log off or after log on or before shutdown this trigger  may be written on
  1.   Database level
  2.   Schema level
OR you can see as follows
Based on timing:
1. Before
2. After
3. Instead of
Based on Event:
1. DDL (Insert, update, delete )
2. DML ( Create, alter, analyze, comment )
3. Database ( After setup, before shutdown)
Based on scope of trigger action:
1. Row level
2. Statement level

Wednesday, October 23, 2013

What are Validation Annotations?

Data annotations are attributes you can find in System.ComponentModel.DataAnnotations namespace. These attributes provide server-side validation, and the framework also supports client-side validation when you use one of the attributes on a model property. You can use four attributes in the DataAnnotations namespace to cover common validation scenarios,
Required, String Length, Regular Expression, Range.

What is ViewState?


For group of views that all use the same layout, this can get a bit redundant and harder to maintain.
The _ViewStart.cshtml page can be used to remove this redundancy. The code within this file is executed before the code in any view placed in the same directory. This file is also recursively applied to any view within a subdirectory.
When we create a default ASP.NET MVC project, we find there is already a _ViewStart .cshtml file in the Views directory. It specifies a default layout:
Layout = "~/Views/Shared/_Layout.cshtml";
Because this code runs before any view, a view can override the Layout property and choose a different one. If a set of views shares common settings, the _ViewStart.cshtml file is a useful place to consolidate these common view settings. If any view needs to override any of the common settings, the view can set those values to another value.

Note: Some of the content has been taken from various sites,books/articles.

What are Scaffold templates?

These templates use the Visual Studio T4 templating system to generate a view based on the model type selected. Scaffolding in ASP.NET MVC can generate the boilerplate code we need for create, read, update, and delete (CRUD) functionality in an application. The scaffolding templates can examine the type definition for, and then generate a controller and the controller’s associated views. The scaffolding knows how to name controllers, how to name views, what code needs to go in each component, and where to place all these pieces in the project for the application to work.

What namespaces MVC use and for what?

What is namespace of ASP.NET MVC?

ASP.NET MVC namespaces as well as classes are located in assembly System.Web.Mvc.
Note: Some of the content has been taken from various books/articles.

What is System.Web.Mvc namespace?

This namespace contains classes and interfaces that support the MVC pattern for ASP.NET Web applications. This namespace includes classes that represent controllers, controller factories, action results, views, partial views, and model binders.

What is System.Web.Mvc.Ajax namespace?

System.Web.Mvc.Ajax namespace contains classes that supports Ajax scripting in an ASP.NET MVC application. The namespace includes support for Ajax scripts and Ajax option settings as well.

What is System.Web.Mvc.Async namespace?

System.Web.Mvc.Async namespace contains classes and interfaces that support asynchronous actions in an ASP.NET MVC application.

What is System.Web.Mvc.Html namespace?

System.Web.Mvc.Html namespace contains classes that help render HTML controls in an MVC application. This namespace includes classes that support forms, input controls, links, partial views, and validation.

What are the various types of Application Templates used to create an MVC application?

The various templates are as follows:
  1. The Internet Application template: This contains the beginnings of an MVC web application — enough so that you can run the application immediately after creating it and see a few pages. This template also includes some basic account management functions which run against the ASP.NET Membership.
  2. The Intranet Application template: The Intranet Application template was added as part of the ASP.NET MVC 3 Tools Update. It is similar to the Internet Application template, but the account management functions run against Windows accounts rather than the ASP.NET Membership system.
  3. The Basic template: This template is pretty minimal. It still has the basic folders, CSS, and MVC application infrastructure in place, but no more. Running an application created using the Empty template just gives you an error message. Why use Basic template? The Basic template is intended for experienced MVC developers who want to set up and configure things exactly how they want them.
  4. The Empty template: The Basic template used to be called the Empty template, but developers complained that it wasn’t quite empty enough. With MVC 4, the previous Empty template was renamed Basic, and the new Empty template is about as empty as we can get. It has the assemblies and basic folder structure in place, but that’s about it.
  5. The Mobile Application template: The Mobile Application template is preconfigured with jQuery Mobile to jump-start creating a mobile only website. It includes mobile visual themes, a touch-optimized UI, and support for Ajax navigation.
  6. The Web API template: ASP.NET Web API is a framework for creating HTTP services. The Web API template is similar to the Internet Application template but is streamlined for Web API development. For instance, there is no user account management functionality, as Web API account management is often significantly different from standard MVC account management. Web API functionality is also available in the other MVC project templates, and even in non-MVC project types.

What are the software requirements of ASP.NET MVC4 application?

MVC 4 runs on the following Windows client operating systems:
  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8
It runs on the following server operating systems:
  • Windows Server 2003
  • Windows Server 2008
  • Windows Server 2008 R2
MVC 4 development tooling is included with Visual Studio 2012 and can be installed on Visual Studio 2010 SP1/Visual Web Developer 2010 Express SP1.

What are the different Config files in MVC4

What is AuthConfig.cs in MVC4?

AuthConfig.cs is used to configure security settings, including sites for OAuth login.

What is BundleConfig.cs in MVC4?

BundleConfig.cs in MVC4 is used to register bundles used by the bundling and minification system. Several bundles are added by default, including jQuery, jQueryUI, jQuery validation, Modernizr, and default CSS references.

What is FilterConfig.cs in MVC4?

This is used to register global MVC filters. The only filter registered by default is the HandleErrorAttribute, but this is a great place to put other filter registrations.

What is RouteConfig.cs in MVC4?

RouteConfig.cs holds the granddaddy of the MVC config statements, Route configuration.

What is WebApiConfig.cs in MVC4?

Used to register Web API routes, as well as set any additional Web API configuration settings.