Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataContextScope"/> class referencing its parent.
 /// </summary>
 private DataContextScope(DataContextScope parent, DataContextScopeOption option)
 {
     _parent = parent;
     _option = option;
     if (IsPrimaryInstance)
     {
         _dataContexts = new Dictionary <Type, object>();
     }
     else
     {
         _dataContexts = parent._dataContexts;
     }
 }
Exemple #2
0
 /// <summary>
 /// Begins a new <see cref="DataContextScope"/>.
 /// </summary>
 /// <param name="option">The <see cref="DataContextScopeOption"/>.</param>
 /// <returns>A <see cref="DataContextScope"/>.</returns>
 /// <remarks>The <paramref name="option"/> determines whether a new connection is created or the existing (default) is leveraged.</remarks>
 public static DataContextScope Begin(DataContextScopeOption option = DataContextScopeOption.UseExisting)
 {
     Current = new DataContextScope(Current, option);
     return(Current);
 }