Showing posts from February, 2018

Dynamic Query in LINQ using Predicate Builder

Introduction This tutorial explains how to create a dynamic query using LINQ, Using Predicate Builder  LINQ to SQL dynamic query and Query with Entity Framework is easy. This concept first implement by albahari Description Predicate Builder is powerful LINQ expression which is mainly used when too many search filter parameter is there for querying data by writing dynamic query expression. We can write a query like Dynamic SQL. To know more about predicate delegate visit Predicate Delegate How To Implement Predicate Builder In this example, I have created an instance of PredicateBuilder with PatientInfo Model and add multiple OR and AND Condition based on their value. Predicate Builder automatically creates a dynamic query with Linq and combined into one Expression. dynamic-linq-sample.cs When We have a grid which filters record based on applied filter and filter parameter is in large number decision of use Dynamic LINQ result very high performance and mi

Connect to TFS using CSharp

Introduction In this article, we learn how to connect TFS (Team Foundation Server) or VSO (Visual Studio Online) or Azure DevOps using C#(csharp). We can create console application based on TFS API. Description Prerequisite Before starting to working on authenticating TFS using C#, we required TFS Client library reference in the project. You can add the required library using a command in NuGet Package Manager. You can install the latest version of the Library for the project. I have referenced NuGet package when I have created this article for my demo app. Install-Package Microsoft.TeamFoundationServer.Client -Version 14.95.3 Install-Package Microsoft.VisualStudio.Services.Client -Version 14.95.3 After adding reference library you can copy below code in your app and add a required reference Namespace in your project. Source Code: NetworkCredential credential = new NetworkCredential( "username" , "password" ); BasicAuthCredent

Login using Google API with C#

Introduction In this article, we learn about how to login using Google OAuth 2.0 with C#(.NET) or Authenticate Google API in Dot Net. Description As we know Google OAuth 2.0 requires  ClientId and ClientSecret  before we proceeding to further step. So, first of all, we have to generate ClientId and ClientSecret from Google Developer Console by creating credential or generating a credential for Web Application or from Native Application. I hope you have google account already if not then first create one before proceeding further. Step 1:  Create Credential for OAuth App. Select credential type OAuth ClientID Step 2: Select appropriate application type from the available option, Here I have choosed "Other". Select application type Based on where we are using login with google account we can select an application type. Here I have used "other" which works for a console app, Web application hosted on localhost as well as on all doma