Beispiel #1
0
 public static IStoreEntity NewStore(this NoSQLContext context)
 {
     return(new StoreEntity()
     {
         StoreId = Guid.NewGuid()
     });
 }
Beispiel #2
0
 public static ITypeVersionEntity NewTypeVersion(this NoSQLContext context)
 {
     return(new TypeVersionEntity()
     {
         TypeVersionId = Guid.NewGuid()
     });
 }
Beispiel #3
0
        public static Int32 DeleteStore(this NoSQLContext context, params IStoreEntity[] storeItems)
        {
            foreach (var item in storeItems)
            {
                context.Store.Remove(item as StoreEntity);
            }

            return(storeItems.Length);
        }
Beispiel #4
0
        public static void UpdateStore(this NoSQLContext context, IStoreEntity storeEntity)
        {
            var entity = context.Store.Find(storeEntity.StoreId);

            entity.DateCreated   = storeEntity.DateCreated;
            entity.LastUpdated   = storeEntity.LastUpdated;
            entity.TypeVersionId = storeEntity.TypeVersionId;
            entity.Value         = storeEntity.Value;
        }
Beispiel #5
0
        public static void AddStore(this NoSQLContext context, IStoreEntity storeEntity)
        {
            var item = context.Store.Create();

            context.Store.Add(item);

            item.StoreId       = storeEntity.StoreId;
            item.TypeVersionId = storeEntity.TypeVersionId;
            item.Value         = storeEntity.Value;
            item.DateCreated   = storeEntity.DateCreated;
            item.LastUpdated   = storeEntity.LastUpdated;
        }
Beispiel #6
0
        public static void AddTypeVersion(this NoSQLContext context, ITypeVersionEntity typeVersionEntity)
        {
            var item = context.TypeVersion.Create();

            context.TypeVersion.Add(item);

            item.AssemblyName  = item.AssemblyName;
            item.TypeName      = typeVersionEntity.TypeName;
            item.TypeSignature = typeVersionEntity.TypeSignature;
            item.TypeVersionId = typeVersionEntity.TypeVersionId;
            item.AssemblyName  = typeVersionEntity.AssemblyName;
            item.DateCreated   = typeVersionEntity.DateCreated;
        }
Beispiel #7
0
        public static ITypeVersionEntity TryFindTypeVersion(this NoSQLContext context, String assemblyName, String typeName, String signature)
        {
            Func <TypeVersionEntity, Boolean> delegateSearch =
                a => a.TypeName == typeName && a.AssemblyName == a.AssemblyName && a.TypeSignature == signature;

            //search local first...
            var item = context.TypeVersion.Local.Where(delegateSearch).FirstOrDefault();

            //now go search against real db
            if (item == null)
            {
                item = context.TypeVersion.Where(delegateSearch).FirstOrDefault();
            }

            return(item as ITypeVersionEntity);
        }
Beispiel #8
0
        public static ITypeVersionEntity TryFindTypeVersion(this NoSQLContext context, Guid typeVersionId)
        {
            Func <TypeVersionEntity, Boolean> delegateSearch =
                a => a.TypeVersionId == typeVersionId;

            //search local first...
            var item = context.TypeVersion.Local.Where(delegateSearch).FirstOrDefault();

            //now go search against real db
            if (item == null)
            {
                item = context.TypeVersion.Where(delegateSearch).FirstOrDefault();
            }

            return(item as ITypeVersionEntity);
        }
Beispiel #9
0
        public static void SeedDemoData(NoSQLContext context)
        {
            context.TypeVersion.Add(new TypeVersionEntity()
            {
                TypeName = typeof(String).AssemblyQualifiedName,
                TypeSignature = String.Empty,
                TypeVersionId = Guid.NewGuid()
            });
            context.Store.Add(new StoreEntity()
            {
                StoreId = Guid.NewGuid(),
                Value = "foo",
                TypeVersionId = context.TypeVersion.First().TypeVersionId
            });

            context.Store.Add(new StoreEntity()
            {
                StoreId = Guid.NewGuid(),
                Value = "bar",
                TypeVersionId = context.TypeVersion.First().TypeVersionId
            });
        }
Beispiel #10
0
        public static void SeedDemoData(NoSQLContext context)
        {
            context.TypeVersion.Add(new TypeVersionEntity()
            {
                TypeName      = typeof(String).AssemblyQualifiedName,
                TypeSignature = String.Empty,
                TypeVersionId = Guid.NewGuid()
            });
            context.Store.Add(new StoreEntity()
            {
                StoreId       = Guid.NewGuid(),
                Value         = "foo",
                TypeVersionId = context.TypeVersion.First().TypeVersionId
            });

            context.Store.Add(new StoreEntity()
            {
                StoreId       = Guid.NewGuid(),
                Value         = "bar",
                TypeVersionId = context.TypeVersion.First().TypeVersionId
            });
        }
Beispiel #11
0
 public static IStoreEntity TryFindStore(this NoSQLContext context, Guid storeId)
 {
     return(context.Store.Where(a => a.StoreId == storeId).FirstOrDefault());
 }
Beispiel #12
0
 public static IStoreArchiveEntity NewStoreArchive(this NoSQLContext context)
 {
     return(new StoreArchiveEntity());
 }
Beispiel #13
0
 private Store(NoSQLContext context, Options options, ISerializerFactory serializerFactory, ITypeVersioner versioner)
     : base(context, options, serializerFactory, versioner)
 {
     this._context = context;
 }
Beispiel #14
0
 private Store(NoSQLContext context)
     : this(context,new Options(), new DefaultSerializerFactory(), new TypeVersioner())
 {
 }