Esempio n. 1
0
        public void CreateResource(AcmaResource resource)
        {
            try
            {
                Monitor.Enter(ServiceMain.Lock);

                if (resource.ObjectID == Guid.Empty)
                {
                    resource.ObjectID = new Guid();
                }

                CSEntryChange csentry = CSEntryChangeDetached.Create();
                csentry.ObjectModificationType = ObjectModificationType.Add;
                csentry.DN         = resource.ObjectID.ToString();
                csentry.ObjectType = resource.ObjectType;

                foreach (var item in resource.Attributes)
                {
                    csentry.AttributeChanges.Add(this.AvpToAttributeChange(item, AttributeModificationType.Add));
                }

                bool refRetry;
                CSEntryExport.PutExportEntry(csentry, out refRetry);
            }
            finally
            {
                Monitor.Exit(ServiceMain.Lock);
            }
        }
Esempio n. 2
0
        public void DeleteResource(string id)
        {
            try
            {
                Monitor.Enter(ServiceMain.Lock);
                CSEntryChange csentry = CSEntryChangeDetached.Create();
                csentry.ObjectModificationType = ObjectModificationType.Delete;
                csentry.DN = id;

                bool refRetry;
                CSEntryExport.PutExportEntry(csentry, out refRetry);
            }
            finally
            {
                Monitor.Exit(ServiceMain.Lock);
            }
        }
Esempio n. 3
0
        public void ReplaceResource(string id, AcmaResource resource)
        {
            try
            {
                Monitor.Enter(ServiceMain.Lock);
                CSEntryChange csentry = CSEntryChangeDetached.Create();
                csentry.ObjectModificationType = ObjectModificationType.Replace;
                csentry.DN = id;

                foreach (var item in resource.Attributes)
                {
                    csentry.AttributeChanges.Add(this.AvpToAttributeChange(item, AttributeModificationType.Add));
                }

                bool refRetry;
                CSEntryExport.PutExportEntry(csentry, out refRetry);
            }
            finally
            {
                Monitor.Exit(ServiceMain.Lock);
            }
        }