IEnumerable VS IQueryable

 

While query data from database, IQueryable execute select query on server side with all filters (e.g SQL select statement on database server). IEnumerable filters the data on client side. (in memory in application)

IEnumerable Example

  1. MyDataContext dc = new MyDataContext ();
  2. IEnumerable<Employee> list = dc.Employees.Where(p => p.Name.StartsWith(“S”));
  3. list = list.Take<Employee>(10);

Generated SQL statements of above query will be :

  1. SELECT [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0]
  2. WHERE [t0].[EmpName] LIKE @p0

Notice that in this query “top 10” is missing since IEnumerable filters records on client side

IQueryable Example

  1. MyDataContext dc = new MyDataContext ();
  2. IQueryable<Employee> list = dc.Employees.Where(p => p.Name.StartsWith(“S”));
  3. list = list.Take<Employee>(10);

Generated SQL statements of above query will be :

  1. SELECT TOP 10 [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0]
  2. WHERE [t0].[EmpName] LIKE @p0

Notice that in this query “top 10” is exist since IQueryable executes query in SQL server with all filters.

 

Source: IEnumerable VS IQueryable

Strongly named assemblies in .NET explained

When the assembly is strongly-named, a “hash” is constructed from the contents of the assembly, and the hash is encrypted with the private key. Then this signed hash is placed in the assembly along with the public key from the .snk.

Later on, when someone needs to verify the integrity of the strongly-named assembly, they build a hash of the assembly’s contents, and use the public key from the assembly to decrypt the hash that came with the assembly – if the two hashes match, the assembly verification passes.

It’s important to be able to verify assemblies in this way to ensure that nobody swaps out an assembly for a malicious one that will subvert the whole application. This is why non-strong-named assemblies aren’t trusted in the same way that strongly-named assemblies are, so they can’t be placed in the GAC. Also, there’s a chain of trust – you can’t generate a strongly-named assembly that references non-strongly-named assemblies.

Source: .net – What is a .snk for? – Stack Overflow

Web Deployment Overview for Visual Studio and ASP.NET

You can deploy a web project by using one-click publish or a deployment package:

  • One-click publish refers to a feature in Visual Studio that lets you deploy directly from the Visual Studio IDE by clicking a button. Visual Studio connects to a destination server, copies project files to it, and performs other deployment tasks.
  • A web deployment package is a .zip file that contains all the information needed for deployment. You create the package from the command line or in Visual Studio, and you install it on the destination server by using the command line or IIS Manager.

Which of these methods you use depends on your scenario and your personal preference. One-click publish is typically the best choice for smaller organizations that do not implement a continuous integration (CI) development process. You would typically deploy to a hosting company where your application runs either in a shared hosting environment or on a dedicated server. (In a shared hosting environment, a single server is used to host sites for multiple hosting company clients.)

Source: Web Deployment Overview for Visual Studio and ASP.NET

Model Binding in ASP.NET MVC

This tutorial explains model binding in asp.net MVC. To understand the model binding in MVC, first let’s see how you can get the http request values in the action method using traditional ASP.NET style. The following figure shows how you can get the values from HttpGET and HttpPOST request by using Request object directly in the action method.

Source: Model Binding