CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of DbContext
C#
public class DbContextDomainService<TContext> : DomainService where TContext : DbContext, new()
{
  private TContext _DbContext;
  protected TContext DbContext
  {
    get
    {              
      return _DbContext ?? (_DbContext = CreateDbContext());
    }
  }
by Shimmy Weitzhandler   May 27, 2011 @ 3:28am
139 Views
no comments
 
C#
public partial class Entities
{
 
  public void Insert<T>(T entity) where T : class
  {
    if (entity == null) throw new ArgumentNullException("entity");
 
    // Note: changing the state to Added on a detached entity is the same as calling
    // Add on the DbSet.                    
    Entry(entity).State = EntityState.Added;
by Shimmy Weitzhandler   May 27, 2011 @ 3:24am
228 Views
no comments
 
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