X Pintrest Facebook YouTube GitHub Amazon
Synergi LINQ Provider Prototype

The last two weeks I have been working on a LINQ provider for Synergi. LINQ is a very nice and useful mechanism for extracting data from any type of data store. When creating a LINQ provider there are some hurdles to overcome. Once you get an understanding of IQueryProvider, IOrderedQueryable<T> and the ExpressionVisitor abstract class, things begin to fall into place.

var query1 = from c in ctx.QuerySynergi
where c.ImportDatabaseID == 2
&& c.CaseTypeD == "Audit p%"
&& c.StatusD == "Registered"
&& c.PersonInChargeD == "%extensive%"
&& c.UnitInChargeD == "Unit 0%"
orderby c.CaseNo ascending
select c;

var query2 = from c in ctx.QuerySynergi
where c.ImportDatabaseID == 2
&& c.CaseType == 115
&& c.Status == 1
&& c.PersonInCharge == 3
&& c.UnitInCharge == 1
orderby c.CaseNo ascending
select c;

Both code snippets produce the same result.

The LINQ provider is not finished yet. There are still a lot more search parameters to add to it, but it is a good example of a LINQ prototype for Synergi.