ln.manage/ManagedContainerBase.cs

47 lines
1.5 KiB
C#

// /**
// * File: ManagedContainerBase.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.Collections.Generic;
namespace ln.manage
{
public abstract class ManagedContainerBase : IManagedContainer
{
IManagedContainer parent;
Dictionary<string, IManagedContainer> containers = new Dictionary<string, IManagedContainer>();
public ManagedContainerBase(IManagedContainer parent,String name)
{
Name = name;
this.parent = parent;
if (parent is ManagedContainerBase managedContainerBase)
{
managedContainerBase.AddContainer(this);
}
}
public string Name { get; }
public IManagedContainer Parent => parent;
public IEnumerable<IManagedContainer> Children => containers.Values;
public abstract IEnumerable<PropertyDescriptor> PropertyDescriptors { get; }
public abstract string IdentityPropertyName { get; }
public abstract IManagedObject CreateManagedObject();
public abstract bool DisposeManagedObject(object identity);
public abstract IManagedObject GetManagedObject(object identity);
public abstract IManagedObject[] GetManagedObjects();
public void AddContainer(IManagedContainer container) => containers.Add(container.Name, container);
}
}