Check out my book "Hands-On RESTful Web Services with ASP.NET Core" available on Amazon or Packt. Source code available on GitHub

Conditional serialization using Csharp

Conditional serialization using Csharp Sometimes you need to serialize attributes according to conditions and properties of your own class, you can do that use the ShouldSerialize method. This method is used by different serialization libraries, for example: System.Xml.Serialization, Newtonsoft.Json (a popular JSON framework for .NET). The following syntax shows the declaration of ShouldSerialize method: Example ...

The difference between IQueryable and IEnumerable

IEnumerable and IQueryable are interfaces that allows you to manipulate and query collections of data. IEnumerable is inherited by IQueryable, that means IQueryable add features to IEnumerable interface. IEnumerable vs IQueryable  IEnumerable IQueryable  System.Collections namespace  System.Linq namespace  LINQ to Object and LINQ to XML  LINQ to SQL  NO lazy loading  lazy loading  in-memory queries  out-memory ...

Entity Framework Async Query

Entity Framework query result

Entity Framework async query The purpose of this example is explain how make async query using Entity Framework. Requirements This example uses .NET Framework 4.5 (or highter) and Entity Framework 6.0 (or highter). The async and await keywords were introduced in .NET 4.5. Defining the model The model describes a product repository. The code below ...

Newer posts