Beispiel #1
0
        /// <summary>
        /// This method is called from the ElementDefinition.Build() method
        /// when the element is completely built and configured. It can also be
        /// called at application startup to register custom types that were built
        /// by the application
        /// </summary>
        void IFluentBuilder.Register(object obj)
        {
            var package = obj as IPackage;

            if (package != null)
            {
                _nameManager.Register(package);
            }

            var module = obj as IModule;

            if (module != null)
            {
                _nameManager.Register(module);
            }

            var element = obj as IElement;

            if (element != null)
            {
                _nameManager.Register(element);
            }

            var dataProvider = obj as IDataProvider;

            if (dataProvider != null)
            {
                _nameManager.Register(dataProvider);
            }

            var dataSupplier = obj as IDataSupplier;

            if (dataSupplier != null)
            {
                _dataCatalog.Register(dataSupplier);
            }
        }
        /// <summary>
        /// This method is called from the ElementDefinition.Build() method
        /// when the element is completely built and configured. It can also be
        /// called at application startup to register custom types that were built
        /// by the application
        /// </summary>
        void IFluentBuilder.Register(object obj)
        {
            var package = obj as IPackage;

            if (package != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering the '" +
                                    package.Name + "' package of type " + obj.GetType().DisplayName() + " with the name manager");
                }
                _nameManager.Register(package);
            }

            var module = obj as IModule;

            if (module != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering the '" +
                                    module.Name + "' module of type " + obj.GetType().DisplayName() + " with the name manager");
                }
                _nameManager.Register(module);
            }

            var runable = obj as IRunable;

            if (runable != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering the '" +
                                    runable.Name + "' runable of type " + obj.GetType().DisplayName() + " with the name manager");
                }
                _nameManager.Register(runable);
            }

            var element = obj as IElement;

            if (element != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering the '" +
                                    element.Name + "' " + element.ElementType + " of type " + obj.GetType().DisplayName() + " with the name manager");
                }
                _nameManager.Register(element);
            }

            var dataProvider = obj as IDataProvider;

            if (dataProvider != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering the '" +
                                    dataProvider.Name + "' data provider of type " + obj.GetType().DisplayName() + " with the name manager");
                }
                _nameManager.Register(dataProvider);
            }

            var dataSupplier = obj as IDataSupplier;

            if (dataSupplier != null)
            {
                if (_debugLogging)
                {
                    Trace.WriteLine("Fluent builder is registering data supplier of type " +
                                    obj.GetType().DisplayName() + " with the data catalog");
                }
                _dataCatalog.Register(dataSupplier);
            }
        }