/// <summary>Change the current global namespace.</summary>
 /// <remarks>Do NOT call this, unless you know exactly what you are doing !</remarks>
 internal void ChangeRoot(IFdbSubspace subspace, IFdbDirectory directory, bool readOnly)
 {
     //REVIEW: rename to "ChangeRootSubspace" ?
     subspace = subspace ?? FdbSubspace.Empty;
     lock (this)            //TODO: don't use this for locking
     {
         m_readOnly        = readOnly;
         m_globalSpace     = FdbSubspace.CopyDynamic(subspace, TypeSystem.Tuples);
         m_globalSpaceCopy = FdbSubspace.CopyDynamic(subspace, TypeSystem.Tuples);                 // keep another copy
         m_directory       = directory == null ? null : new FdbDatabasePartition(this, directory);
     }
 }
Esempio n. 2
0
 /// <summary>Return a version of this subspace, which uses a different type system to produces the keys and values</summary>
 /// <param name="subspace">Instance of a generic subspace</param>
 /// <param name="encoder">Custom key encoder</param>
 /// <returns>Subspace equivalent to <paramref name="subspace"/>, but augmented with a specific TypeSystem</returns>
 public static IFdbDynamicSubspace UsingEncoder([NotNull] this IFdbSubspace subspace, [NotNull] IDynamicKeyEncoder encoder)
 {
     if (subspace == null)
     {
         throw new ArgumentNullException("subspace");
     }
     if (encoder == null)
     {
         throw new ArgumentNullException("encoder");
     }
     return(FdbSubspace.CopyDynamic(subspace, encoder));
 }
Esempio n. 3
0
 /// <summary>Return a version of this subspace, which uses a different type system to produces the keys and values</summary>
 /// <param name="subspace">Instance of a generic subspace</param>
 /// <param name="encoding">If non-null, uses this specific instance of the TypeSystem. If null, uses the default instance for this particular TypeSystem</param>
 /// <returns>Subspace equivalent to <paramref name="subspace"/>, but augmented with a specific TypeSystem</returns>
 public static IFdbDynamicSubspace Using([NotNull] this IFdbSubspace subspace, [NotNull] IFdbKeyEncoding encoding)
 {
     if (subspace == null)
     {
         throw new ArgumentNullException("subspace");
     }
     if (encoding == null)
     {
         throw new ArgumentNullException("encoding");
     }
     return(FdbSubspace.CopyDynamic(subspace, encoding));
 }
Esempio n. 4
0
 public static IFdbDynamicSubspace UsingEncoder([NotNull] this IFdbSubspace subspace, [NotNull] IDynamicKeyEncoder encoder)
 {
     Contract.NotNull(subspace, nameof(subspace));
     Contract.NotNull(encoder, nameof(encoder));
     return(FdbSubspace.CopyDynamic(subspace, encoder));
 }
Esempio n. 5
0
 public static IFdbDynamicSubspace Using([NotNull] this IFdbSubspace subspace, [NotNull] IFdbKeyEncoding encoding)
 {
     Contract.NotNull(subspace, nameof(subspace));
     Contract.NotNull(encoding, nameof(encoding));
     return(FdbSubspace.CopyDynamic(subspace, encoding));
 }