LinQ Extended

Hi.

How can LinQ be extended ?

I'd like to extend it in a way that will require me writing some SQL code for INSERT and UPDATE statements, is that possible?

thanks.

[190 byte] By [8768] at [2008-1-5]
# 1

One way to do that is using particular methods prototypes in your derived DataContext class. When the SubmitChanges() method is called and these methods have been written in the code, DataContext doesn't produce the SQL statement but calls the related method. Here follows both prototypes:

Code Snippet

public void InsertMethod(Entity e)

public void UpdateMethod(Entity old, Entity new)

where you have to substitute Entity with your entity class name (even the method name can be changed).

Within the body of these methods you can create your own SQL statement or call a stored procedure, as you prefer.

Best,

Fabio

Bltfast at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...

Visual Studio Orcas

Site Classified