예제 #1
0
        public void AddObject <T>(string cnName, T entry) where T : class
        {
            if (!string.IsNullOrEmpty(cnName) && entry != null)
            {
                var entryObject = entry as EntryObject;

                if (entryObject != null)
                {
                    if (entryObject.Parent == null)
                    {
                        var schemaName = typeof(T).AssertGetAttribute <DirectoryTypeAttribute>();

                        entryObject.SetParent(new NamedEntryObject
                        {
                            Entry = GetParentDirectoryEntry(schemaName)
                        });
                    }

                    entryObject.Context = this;
                    entryObject.AddToParent(cnName);
                    ChangeTracker.AddObject(entryObject);
                }

                //TODO: Handle non-EntryObject types. - Stephen Baker
            }
        }