public ITrustBoundary AddTrustBoundary([Required] string name, ITrustBoundaryTemplate template)
        {
            ITrustBoundary result = new TrustBoundary(this, name)
            {
                _templateId = template?.Id ?? Guid.Empty
            };

            if (_groups == null)
            {
                _groups = new List <IGroup>();
            }
            _groups.Add(result);
            RegisterEvents(result);
            SetDirty();
            ChildCreated?.Invoke(result);

            return(result);
        }
        public T AddGroup <T>([Required] string name) where T : class, IGroup
        {
            T result = default(T);

            if (typeof(T) == typeof(ITrustBoundary))
            {
                result = new TrustBoundary(this, name) as T;
                if (_groups == null)
                {
                    _groups = new List <IGroup>();
                }
                _groups.Add(result);
                SetDirty();
                RegisterEvents(result);
                ChildCreated?.Invoke(result);
            }

            return(result);
        }
Пример #3
0
        public IGroup AddGroup <T>([Required] string name) where T : IGroup
        {
            IGroup result = null;

            if (typeof(T) == typeof(ITrustBoundary))
            {
                result = new TrustBoundary(this, name);
                if (_groups == null)
                {
                    _groups = new List <IGroup>();
                }
                _groups.Add(result);
                Dirty.IsDirty = true;
                RegisterEvents(result);
                ChildCreated?.Invoke(result);
            }

            return(result);
        }