コード例 #1
0
        public T BuildNew <T>(bool suppressEventing)
            where T : class, IData
        {
            ValidateBuildNewType(typeof(T));

            Type generatedType = DataTypeTypesManager.GetDataTypeEmptyClass(typeof(T));

            IData data = (IData)Activator.CreateInstance(generatedType, new object[] { });

            SetNewInstanceFieldDefaultValues(data);

            if (suppressEventing == false)
            {
                DataEventSystemFacade.FireDataAfterBuildNewEvent <T>(data);
            }

            return((T)data);
        }
コード例 #2
0
        public IData BuildNew(Type interfaceType, bool suppressEventling)
        {
            if (interfaceType == null)
            {
                throw new ArgumentNullException("interfaceType");
            }

            ValidateBuildNewType(interfaceType);

            Type generatedType = DataTypeTypesManager.GetDataTypeEmptyClass(interfaceType);

            IData data = (IData)Activator.CreateInstance(generatedType, new object[] { });

            SetNewInstanceFieldDefaultValues(data);

            if (!suppressEventling)
            {
                DataEventSystemFacade.FireDataAfterBuildNewEvent(generatedType, data);
            }

            return(data);
        }