Mehfuz's WebLog

Live crazy, think different!



Passionate about cutting edge technologies and facinated by the modern web and phone revolution.Currently working at Telerik Corporation, the leading .net component vendor.
Follow me



LinqExtender 1.01 released

I have released the new version of LinqExtender,  it now support orderby queries

Like I can easily do

var query = from q in context
            where q.Id == 1
            orderby q.Id descending 
            select q;

Also, I have uploaded a tiny linq to sql project named OpenLinqToSql which is built on LinqExtender and can be downloaded from LinqExtender release page

To start working with OpenLinqToSql, all is needed.

First create a object that represents the entity class.For example , i have created a Book table in database , which looks like

CREATE TABLE [dbo].[Book](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Author] [nvarchar](255) NOT NULL,
    [Title] [nvarchar](255) NOT NULL,
    [ISBN] [nvarchar](50) NOT NULL,
    [LastUpdated] datetime NOT NULL


For which the representation of object is

class Book : QueryObjectBase
        [LinqVisible, Identity]
        public int? Id { get; set; }
        public string Author { get; set; }
        public string Title { get; set; }
        public string ISBN { get; set; }
        public DateTime? LastUpdated {get; set;} 

        public override bool IsNew
                return Id == null;

Here to note that, in order to use a property in query expression, LinqVisibleattribute is used. Also, Non string properties, should be made Nullable.

Finally, I can do the following to get things going

SqlQuery<Book> context = new SqlQuery<Book>();

Write the query.

var query = from q in context
            orderby q.Id descending
            select q;

The OpenLinqToSql can talk with SQLCE databases as well. Also, this is just an tiny project that helps to understand how to make providers using LinqExtender, but for real flavor , use the LinqToSql that comes with .net 3.5


kick it on


No Comments