Exemple #1
0
        public override sealed async Task CreateAsync(Persist <TModel> persist)
        {
            if (persist.Models.Length == 0)
            {
                return;
            }

            TModel[] compressedModels = CompressModels(persist.Models, persist.Graph, true);
            await NextProvider.PersistAsync(new Create <TModel>(persist.Event, compressedModels, persist.Graph));

            for (var i = 0; i < persist.Models.Length; i++)
            {
                object identity = ModelAnalyzer.GetIdentity(compressedModels[i]);
                ModelAnalyzer.SetIdentity(persist.Models[i], identity);
            }
        }
        public override sealed void Create(Persist <TModel> persist)
        {
            if (persist.Models.Length == 0)
            {
                return;
            }

            TModel[] encryptedModels = EncryptModels(persist.Models, persist.Graph, true);
            NextProvider.Persist(new Create <TModel>(encryptedModels, persist.Graph));

            for (var i = 0; i < persist.Models.Length; i++)
            {
                object identity = ModelAnalyzer.GetIdentity(encryptedModels[i]);
                ModelAnalyzer.SetIdentity(persist.Models[i], identity);
            }
        }
Exemple #3
0
        public override sealed async Task DeleteAsync(Persist <TModel> persist)
        {
            ICollection returnIds;

            if (persist.IDs != null)
            {
                returnIds = OnDelete(persist.IDs);
            }
            else
            {
                List <object> ids = new List <object>();
                foreach (TModel model in persist.Models)
                {
                    ids.Add(ModelAnalyzer.GetIdentity <TModel>(model));
                }

                returnIds = OnDelete(ids);
            }

            await NextProvider.PersistAsync(new DeleteByID <TModel>(persist.Event, returnIds));

            OnDeleteComplete(returnIds);
        }
        public async Task PersistAsync(Persist <TModel> persist)
        {
            await ThisProvider.PersistAsync(persist);

            await NextProvider.PersistAsync(persist);
        }
 public void Persist(Persist <TModel> persist)
 {
     ThisProvider.Persist(persist);
     NextProvider.Persist(persist);
 }
Exemple #6
0
 public override sealed Task DeleteAsync(Persist <TModel> persist)
 {
     return(NextProvider.PersistAsync(persist));
 }
Exemple #7
0
 public override sealed void Delete(Persist <TModel> persist)
 {
     NextProvider.Persist(persist);
 }
Exemple #8
0
        public static void Persist <TModel>(Persist <TModel> persist) where TModel : class, new()
        {
            var provider = Resolver.Get <ITransactStoreProvider <TModel> >();

            provider.Persist(persist);
        }
Exemple #9
0
        public static Task PersistAsync <TModel>(Persist <TModel> persist) where TModel : class, new()
        {
            var provider = Resolver.Get <ITransactStoreProvider <TModel> >();

            return(provider.PersistAsync(persist));
        }