예제 #1
0
        public static TransientModel NewModel(Type compositeType,
                                              Visibility visibility,
                                              MetaInfo metaInfo,
                                              PropertyDeclarations propertyDeclarations,
                                              IEnumerable <Type> assemblyConcerns,
                                              IEnumerable <Type> sideEffects, IList <Type> mixins)
        {
            var  constraintsModel = new ConstraintsModel(compositeType);
            bool immutable        = metaInfo.Get <ImmutableAttribute>() != null;
            var  propertiesModel  = new TransientPropertiesModel(constraintsModel, propertyDeclarations, immutable);
            var  stateModel       = new TransientStateModel(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 TransientModel(compositeType, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel));
        }
예제 #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));
        }
예제 #3
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);
        }
예제 #4
0
 public CompositeMethodsModel(Type compositeType, ConstraintsModel constraintsModel, ConcernsDeclaration concernsModel, SideEffectsDeclaration sideEffectsModel, AbstractMixinsModel mixinsModel)
 {
     this.methods          = new Dictionary <MethodInfo, CompositeMethodModel>();
     this.properties       = new List <PropertyInfo>();
     this.compositeType    = compositeType;
     this.concernsModel    = concernsModel;
     this.sideEffectsModel = sideEffectsModel;
     this.mixinsModel      = mixinsModel;
     this.constraintsModel = constraintsModel;
     this.BuildMixinsModel(compositeType);
     this.ImplementMixinMethods();
 }
예제 #5
0
 public CompositeMethodsModel(Type compositeType, ConstraintsModel constraintsModel, ConcernsDeclaration concernsModel, SideEffectsDeclaration sideEffectsModel, AbstractMixinsModel mixinsModel)
 {
     this.methods = new Dictionary<MethodInfo, CompositeMethodModel>();
     this.properties = new List<PropertyInfo>();
     this.compositeType = compositeType;
     this.concernsModel = concernsModel;
     this.sideEffectsModel = sideEffectsModel;
     this.mixinsModel = mixinsModel;
     this.constraintsModel = constraintsModel;
     this.BuildMixinsModel(compositeType);
     this.ImplementMixinMethods();
 }
예제 #6
0
        public MixinModel(Type mixinType)
        {
            this.MixinType = mixinType;

            this.injectedObjectBuilder = new InjectedObjectBuilder(mixinType);

            var concerns = new List<ConcernDeclaration>();
            ConcernsDeclaration.ConcernDeclarations(mixinType, concerns);
            this.concernsDeclaration = new ConcernsDeclaration(concerns);
            this.sideEffectsDeclaration = new SideEffectsDeclaration(mixinType, Enumerable.Empty<Type>());

            this.thisMixinTypes = this.BuildThisMixinTypes();
        }
예제 #7
0
        public MixinModel(Type mixinType)
        {
            this.MixinType = mixinType;

            this.injectedObjectBuilder = new InjectedObjectBuilder(mixinType);

            var concerns = new List <ConcernDeclaration>();

            ConcernsDeclaration.ConcernDeclarations(mixinType, concerns);
            this.concernsDeclaration    = new ConcernsDeclaration(concerns);
            this.sideEffectsDeclaration = new SideEffectsDeclaration(mixinType, Enumerable.Empty <Type>());

            this.thisMixinTypes = this.BuildThisMixinTypes();
        }
예제 #8
0
        public static ValueModel NewModel(Type compositeType, Visibility visibility, MetaInfo metaInfo, PropertyDeclarations propertyDeclarations, List<Type> assemblyConcerns, List<Type> sideEffects, List<Type> mixins)
        {
            var constraintsModel = new ConstraintsModel(compositeType);
            bool immutable = metaInfo.Get<ImmutableAttribute>() != null;
            var propertiesModel = new ValuePropertiesModel(constraintsModel, propertyDeclarations, immutable);
            var stateModel = new ValueStateModel(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 ValueModel(compositeType, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel);
        }