Tag Archives: LINQ

Why EntitySet not auto-generated by LINQ-to-SQL?

It turns out the the child table must have a primary key. If not set in database level, that can be set in the *dbml file. Multiple-field primary key works too. Advertisements

Posted in ASP.NET | Tagged , | Leave a comment

Using Full Text Search with LINQ

LINQ does not natively support full text search keywords (FREETEXT, CONTAINS etc).  Actually the compiler won’t complain about them but just translate everything to LIKE. Here is the work around: 1. Create a table-valued function that takes in keyword as … Continue reading

Posted in ASP.NET, SQL | Tagged | Leave a comment

LINQ: add association for database views

The LINQ to SQL Designer automatically create association for tables that have foreign keys defined. However for database views, it won’t because there is no foreign keys relationship in views. Manually adding association in the Designer will not create “private … Continue reading

Posted in ASP.NET | Tagged | Leave a comment

No database-like triggers in LINQ, and things to look out

In my LINQ application, I was looking for a UPDATE trigger implementation (in LINQ of course, not in DB), so that whenever a record is taken offline, I can record the time and user who does that. This actually can … Continue reading

Posted in ASP.NET | Tagged | 1 Comment

LINQ: cache with (child) collection properties

By default, because of the “Lazy Loading” setting, LINQ won’t load the child properties collection data until they are first accessed. So for the caching purpose, we have to force it to load everything before releasing the DataContext.  This is … Continue reading

Posted in ASP.NET | Tagged | Leave a comment

Caching with LINQ (“delayed” execution)

To increase the site performance, I cached (at least I thought I did) the result from a LINQ query into Application.Cache. The code is like this: public static List<Region> GetAllRegions() { if (MyCache.GetCache(“RegionListFromDB”) == null) { using (MyInfoDataContext db = … Continue reading

Posted in .NET, ASP.NET | Tagged | 1 Comment