示例#1
0
        public static ServiceModel NewModel(Type compositeType,
                                            Visibility visibility,
                                            MetaInfo metaInfo,
                                            IEnumerable<Type> assemblyConcerns,
                                            IEnumerable<Type> sideEffects,
                                            IList<Type> mixins,
                                            String moduleName,
                                            String identity,
                                            bool instantiateOnStartup)
        {
            PropertyDeclarations propertyDeclarations = new MetaInfoDeclaration();
            var constraintsModel = new ConstraintsModel(compositeType);
            bool immutable = metaInfo.Get<ImmutableAttribute>() != null;
            var propertiesModel = new ServicePropertiesModel(constraintsModel, propertyDeclarations, immutable);
            var stateModel = new ServiceStateModel(propertiesModel);
            var mixinsModel = new MixinsModel(compositeType, mixins);

            var concerns = new List<ConcernDeclaration>();
            ConcernsDeclaration.ConcernDeclarations(assemblyConcerns, concerns);
            ConcernsDeclaration.ConcernDeclarations(compositeType, concerns);
            var concernsModel = new ConcernsDeclaration(concerns);
            var sideEffectsModel = new SideEffectsDeclaration(compositeType, sideEffects);
            var compositeMethodsModel = new CompositeMethodsModel(compositeType, constraintsModel, concernsModel, sideEffectsModel, mixinsModel);
            stateModel.AddStateFor(compositeMethodsModel.Properties, compositeType);

            return new ServiceModel(
                    compositeType, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel, moduleName, identity, instantiateOnStartup);
        }
示例#2
0
        public static ServiceModel NewModel(Type compositeType,
                                            Visibility visibility,
                                            MetaInfo metaInfo,
                                            IEnumerable <Type> assemblyConcerns,
                                            IEnumerable <Type> sideEffects,
                                            IList <Type> mixins,
                                            String moduleName,
                                            String identity,
                                            bool instantiateOnStartup)
        {
            PropertyDeclarations propertyDeclarations = new MetaInfoDeclaration();
            var  constraintsModel = new ConstraintsModel(compositeType);
            bool immutable        = metaInfo.Get <ImmutableAttribute>() != null;
            var  propertiesModel  = new ServicePropertiesModel(constraintsModel, propertyDeclarations, immutable);
            var  stateModel       = new ServiceStateModel(propertiesModel);
            var  mixinsModel      = new MixinsModel(compositeType, mixins);

            var concerns = new List <ConcernDeclaration>();

            ConcernsDeclaration.ConcernDeclarations(assemblyConcerns, concerns);
            ConcernsDeclaration.ConcernDeclarations(compositeType, concerns);
            var concernsModel         = new ConcernsDeclaration(concerns);
            var sideEffectsModel      = new SideEffectsDeclaration(compositeType, sideEffects);
            var compositeMethodsModel = new CompositeMethodsModel(compositeType, constraintsModel, concernsModel, sideEffectsModel, mixinsModel);

            stateModel.AddStateFor(compositeMethodsModel.Properties, compositeType);

            return(new ServiceModel(
                       compositeType, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel, moduleName, identity, instantiateOnStartup));
        }