CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Domain Service methods snippet

390 Views
Copy Code Show/Hide Line Numbers
#region $entity$
 
public IQueryable<$entity$> Get$entities$()
{
    return this.DataContext.$entities$;
}
 
public void Insert$entity$($entity$ current$entity$)
{
    this.DataContext.$entities$.InsertOnSubmit(current$entity$);
}
 
public void Update$entity$($entity$ current$entity$)
{
    this.DataContext.$entities$.Attach(current$entity$, this.ChangeSet.GetOriginal(current$entity$));
}
 
public void Delete$entity$($entity$ current$entity$)
{
    this.DataContext.$entities$.Attach(current$entity$);
    this.DataContext.$entities$.DeleteOnSubmit(current$entity$);
}
 
#endregion
by Glenn Block
  March 23, 2010 @ 11:39pm
Tags:
Description:
Paste this in as a VS snippet for creating crud methods.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate