Exemple #1
0
 public UpdateCascadeOperationExecutor(DocumentDatabase db, UpdateCascadeSetting setting, UpdateCascadeOperation operation, JsonDocument referencedDoc)
 {
     this.db            = db;
     this.services      = Services.GetServices(db);
     this.setting       = setting;
     this.operation     = operation;
     this.referencedDoc = referencedDoc;
 }
 public UpdateCascadeOperationExecutor(DocumentDatabase db, UpdateCascadeSetting setting, UpdateCascadeOperation operation, JsonDocument referencedDoc)
 {
     this.db = db;
     this.services = Services.GetServices(db);
     this.setting = setting;
     this.operation = operation;
     this.referencedDoc = referencedDoc;
 }
        private UpdateCascadeSetting GetSetting(RavenJObject metadata)
        {
            var entityName = metadata.Value <string>(Constants.RavenEntityName);
            UpdateCascadeSetting setting = null;
            string settingId             = UpdateCascadeSetting.GetId(entityName);

            services.SettingsCache.EnsureInitialized(this.Database);
            services.SettingsCache.TryGetValue(settingId, out setting);
            return(setting);
        }
 public UpdateCascadeOperation(UpdateCascadeSetting setting, string referencedDocId, Guid referencedDocEtag)
 {
     ReferencedDocId        = referencedDocId;
     ReferencedDocEtag      = referencedDocEtag;
     Status                 = UpdateCascadeOperationStatus.Pending;
     UpdateCascadeSettingId = setting.Id;
     Etag = Guid.Empty;
     CollectionOperations = new List <ReferencingCollectionOperation>(
         setting.ReferencingCollections.Values.Select(rc => new ReferencingCollectionOperation
     {
         ReferencingEntityName = rc.ReferencingEntityName
     })
         );
 }
 private static bool HasAnyReferencedPropertyChanged(RavenJObject original, RavenJObject current, UpdateCascadeSetting setting)
 {
     return(setting.DenormalizedReferencePropertyNames.Any(pn => !RavenJToken.DeepEquals(original[pn], current[pn])));
 }
        public void SetUpUpdateCascadeSettings()
        {
            var setting = new UpdateCascadeSetting
            {
                ReferencedEntityName = "Categories",
                DenormalizedReferencePropertyNames = new List<string>
                {
                    "Name"
                },
                ReferencingCollections = new Dictionary<string, ReferencingCollectionSetting>
                {
                    {
                        "Products",
                        new ReferencingCollectionSetting
                        {
                            IndexName = "Products/ByCategoryId",
                            ReferencingEntityName = "Products",
                            ReferencingPropertyPath = "Category",
                            ReferencedEtagPropertyNameInIndex = "Etag",
                            ReferencedIdPropertyNameInIndex = "CategoryId"
                        }
                    }
                }
            };

            using (var session = this.Store.OpenSession())
            {
                session.Store(setting);
                session.SaveChanges();

                var s = session.Advanced.DocumentStore.DatabaseCommands.Get(setting.Id);
            }
        }
 public UpdateCascadeOperation(UpdateCascadeSetting setting, string referencedDocId, Guid referencedDocEtag)
 {
     ReferencedDocId = referencedDocId;
     ReferencedDocEtag = referencedDocEtag;
     Status = UpdateCascadeOperationStatus.Pending;
     UpdateCascadeSettingId = setting.Id;
     Etag = Guid.Empty;
     CollectionOperations = new List<ReferencingCollectionOperation>(
         setting.ReferencingCollections.Values.Select(rc => new ReferencingCollectionOperation
         {
             ReferencingEntityName = rc.ReferencingEntityName
         })
     );
 }
 private static bool HasAnyReferencedPropertyChanged(RavenJObject original, RavenJObject current, UpdateCascadeSetting setting)
 {
     return setting.DenormalizedReferencePropertyNames.Any(pn => !RavenJToken.DeepEquals(original[pn], current[pn]));
 }
Exemple #9
0
 public bool TryGetValue(string id, out UpdateCascadeSetting setting)
 {
     return(cache.TryGetValue(id, out setting));
 }