Using SQL LIKE operator in Entity Framework

Like clause is most useful free text search in SQL Server. Currently Entity Framework doesn't have support for like operator. There are alternative ways, you can use StartWith, Contains or EndWith operators to build your query.

In this article I am going to show you how to use SQL LIKE operator using SqlFunctions.PatIndex. It will return the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types. You cannot call this function directly. This function can only appear within a LINQ to Entities query.

PATINDEX ( '%pattern%' , expression )Pattern
A character expression that contains the sequence to be found. Wildcard characters can be used; however, the % character must come before and follow pattern (except when you search for first or last characters).
A column that is searched for the specified pattern.
How to Use
var employeeList = Employees …

.NET Core 2.0 released! What is new?

.NET Core is final release is available and you can start working on .NET Core using Visual Studio 2017 15.3, Visual Studio Code or Visual Studio for Mac. At the same moment they also released ASP.NET Core 2.0 and Entity Framework 2.0. For a full list of updates, you can read the release notes and you can check the list of changed items in the ASP.NET Announcements GitHub repository for a list of changes from previous versions of ASP.NET Core.

Too many minor and major features are shipped in .NET Core 2.0 but Razor support would be the show stopper for me.

Watch the announcement video to see features in action.
ReferenceAnnouncing ASP.NET Core 2.0NET Core 2.0 Released (Channel 9 Video)

Microsoft Cognitive Toolkit 2.0 (CNTK) is available now

CNTK aka Cognitive toolkit was released beta version by Microsoft last year. CNTK is mainly focus on deep learning and Microsoft artificial intelligence services. CNTK is now updated with new version 2.0. The Microsoft Cognitive Toolkit trains and evaluates deep learning algorithms faster than other available toolkits, scaling efficiently in a range of environments—from a CPU, to GPUs, to multiple machine while maintaining accuracy.

Main features are
Highly optimized, built-in componentssEfficiet resource usageEasily express your own networksTraining and hosting with Azure Preview,

How to Configure NLog in ASP.NET Core

In my earlier article, I explained how to configure error logging module (ELM) in Core. ELM Microsoft's own logging framework but it has limited functionality and not recommended for enterprise applications. NLog comes to save the day for provide better logging facility. Today,  I am going to explain how to configure the NLog library into the Core project.
What is NLog?NLog is free logging platform for .NET, NET Standard, Xamarin, Silverlight and Windows Phone with rich log routing and management capabilities. NLog makes it easy to produce and manage high-quality logs for your application regardless of its size or complexity. NLog is easy to configure, templatable and extensible to us it more effectively.
Add NLog to ASP.NET CoreSetup new ASP.NET Core project with visual studio 2015+. You can choose any project type either MVC or web.API, NLog will work with both.
Install swagger from nuget using package manager console.
PM> Install-Package NLog.Web.AspNetCoreHe…

Configure Swagger UI in Core Web API

Documentation is very much important when Web.API has been exposed for public access. A clean documentation gives a more helpful to integrate APIs.Today, we are going to discuss and implement simple yet powerful API documentation library that's definitely going to help you to make your works easy. What is Swagger?Swagger provides rich documentation and seamless  API testing experience to developers. It is a open source framework backed by a large ecosystem of tools that helps you design, build, document, and consume your RESTful APIs. Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your Swagger specification, with the visual documentation making it easy for back end implementation and client side consumption. Add Swagger to ASP.NET Core Web.APISetup new ASP.NET Core Web.API project with visual studio default web …

Configure Error Logging Middleware (ELM) - in ASP.NET Core

As we discussed in our previous articles Elmah is most popular and easy to implement exception handling module for .net application. After launching, open source elmah library won't get updated. The current elmah library will not work as it's based on Asp.Net 4.x's modules and Handlers. Using ELM prototype you can capture unhandled Exceptions as well as logging. You can install Error Logging Middleware either from Package Management Console or Nuget package manager.
Install via nuget
PM> Install-Package Microsoft.AspNetCore.Diagnostics.Elm or install through
"dependencies": { "Microsoft.NETCore.App": { "version": "1.0.1", "type": "platform" }, "Microsoft.AspNetCore.Diagnostics": "1.1.0", "Microsoft.AspNetCore.Diagnostics.Elm": "0.2.0","Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Razor.Tools": { "version&qu…