Csla.Data.EF4.DbContextManager.AddRef()

Here are the examples of the csharp api class Csla.Data.EF4.DbContextManager.AddRef() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: csla
Source File: DbContextManager.cs
View license
public static DbContextManager<C> GetManager(string database, string label, DbCompiledModel model)
    {
      lock (_lock)
      {
        var contextLabel = GetContextName(database, label);
        DbContextManager<C> mgr = null;
        if (ApplicationContext.LocalContext.Contains(contextLabel))
        {
          mgr = (DbContextManager<C>)(ApplicationContext.LocalContext[contextLabel]);
        }
        else
        {
          mgr = new DbContextManager<C>(database, label, model, null);
          mgr.ContextLabel = contextLabel;
          ApplicationContext.LocalContext[contextLabel] = mgr;
        }
        mgr.AddRef();
        return mgr;
      }
    }

2. Example

Project: csla
Source File: DbContextManager.cs
View license
public static DbContextManager<C> GetManager(ObjectContext context, string label)
    {
      lock (_lock)
      {
        var contextLabel = GetContextName(context.DefaultContainerName, label);
        DbContextManager<C> mgr = null;
        if (ApplicationContext.LocalContext.Contains(contextLabel))
        {
          mgr = (DbContextManager<C>)(ApplicationContext.LocalContext[contextLabel]);
        }
        else
        {
          mgr = new DbContextManager<C>(null, label, null, context);
          mgr.ContextLabel = contextLabel;
          ApplicationContext.LocalContext[contextLabel] = mgr;
        }
        mgr.AddRef();
        return mgr;
      }
    }