Example #1
0
        /// <summary>
        /// Creates a new instance of <see cref="ApplicationModelCreatedArgs"/>.
        /// </summary>
        /// <param name="architecture">The <see cref="ApplicationArchitecture{T}"/> which is creating the model.</param>
        /// <param name="model">The newly created <see cref="ApplicationModel{T}"/>.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="architecture"/> or <paramref name="model"/> is <c>null</c>.</exception>
        public ApplicationModelCreatedArgs(ApplicationArchitecture <ApplicationModel <ApplicationSPI> > architecture, ApplicationModel <ApplicationSPI> model)
        {
            ArgumentValidator.ValidateNotNull("Architecture", architecture);
            ArgumentValidator.ValidateNotNull("Model", model);

            this._architecture = architecture;
            this._model        = model;
        }
Example #2
0
        public AssemblerImpl(ApplicationArchitecture <ApplicationModel <ApplicationSPI> > applicationArchitecture, Func <Int32> newCompositeIDRequestor, DictionaryQuery <CompositeModelType, CompositeModelTypeAssemblyScopeSupport> modelTypeSupport, UsesContainerMutable parentContainer, CollectionsFactory collectionsFactory)
        {
            ArgumentValidator.ValidateNotNull("Application architecture", applicationArchitecture);
            ArgumentValidator.ValidateNotNull("ID requestor function", newCompositeIDRequestor);
            ArgumentValidator.ValidateNotNull("Model type support", modelTypeSupport);
            ArgumentValidator.ValidateNotNull("Parent uses container", parentContainer);
            ArgumentValidator.ValidateNotNull("Collections factory", collectionsFactory);

            this._applicationArchitecture = applicationArchitecture;
            this._newCompositeIDRequestor = newCompositeIDRequestor;
            this._collectionsFactory      = collectionsFactory;
            this._compositeInfos          = this._collectionsFactory.NewDictionaryProxy <CompositeModelType, DictionaryWithRoles <Type, ListProxy <CompositeAssemblyInfo>, ListProxyQuery <CompositeAssemblyInfo>, ListQuery <CompositeAssemblyInfo> > >();
            this._assemblyScopeSupport    = modelTypeSupport;
            this._parentContainer         = parentContainer;
        }
        protected ApplicationModelSkeletonImmutable(
            ApplicationArchitecture <ApplicationModel <ApplicationSPI> > architecture,
            Type genericCompositePropertyMixin,
            Type genericCompositeEventMixin,
            Type genericFragmentBaseType,
            DictionaryQuery <CompositeModelType, CompositeModelTypeAssemblyScopeSupport> modelTypeAssemblyScopeSupport,
            out DictionaryQuery <CompositeModelType, CompositeModelTypeModelScopeSupport> compositeModelTypeSupport,
            out DictionaryProxy <Int32, CompositeModel> models
            )
        {
            ArgumentValidator.ValidateNotNull("Application architecture", architecture);
            ArgumentValidator.ValidateNotNull("Generic composite property mixin", genericCompositePropertyMixin);
            ArgumentValidator.ValidateNotNull("Generic composite event mixin", genericCompositeEventMixin);
            ArgumentValidator.ValidateNotNull("Generic fragment base type", genericFragmentBaseType);

            this._injectionService = new InjectionServiceImpl();
            this._genericCompositePropertyMixin = genericCompositePropertyMixin;
            this._genericCompositeEventMixin    = genericCompositeEventMixin;
            this._genericFragmentBaseType       = genericFragmentBaseType;
            this._collectionsFactory            = architecture.CollectionsFactory;
            this._compositeModelTypeSupport     = this._collectionsFactory.NewDictionaryProxy <CompositeModelType, CompositeModelTypeModelScopeSupport>(modelTypeAssemblyScopeSupport.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.CreateModelScopeSupport())).CQ;
            this._models              = this._collectionsFactory.NewDictionaryProxy <Int32, CompositeModel>();
            this._validationResult    = new Lazy <ApplicationValidationResultIQ>(this.DoValidate, System.Threading.LazyThreadSafetyMode.ExecutionAndPublication);
            compositeModelTypeSupport = this._compositeModelTypeSupport;
            models             = this._models;
            this._typeModelDic = new Lazy <DictionaryQuery <CompositeModel, CompositeTypeModel> >(() =>
                                                                                                  this._collectionsFactory.NewDictionaryProxy(this.CompositeModels.Values
                                                                                                                                              .Select(cModel => Tuple.Create(cModel, ((CompositeValidationResultImmutable)this._validationResult.Value.CompositeValidationResults[cModel]).TypeModel))
                                                                                                                                              .ToDictionary(tuple => tuple.Item1, tuple => tuple.Item2, ReferenceEqualityComparer <CompositeModel> .ReferenceBasedComparer)).CQ
                                                                                                  , System.Threading.LazyThreadSafetyMode.ExecutionAndPublication);
            this._affectedAssemblies = new Lazy <SetQuery <Assembly> >(() =>
                                                                       this._collectionsFactory.NewSetProxy(new HashSet <Assembly>(
                                                                                                                this._typeModelDic.Value
                                                                                                                .SelectMany(tModel => tModel.Key.PublicTypes
                                                                                                                            .Concat(tModel.Value.PrivateCompositeTypeInfos.Keys)
                                                                                                                            .Concat(tModel.Value.FragmentTypeInfos.Keys)
                                                                                                                            .Concat(tModel.Value.ConcernInvocationTypeInfos.Keys)
                                                                                                                            .Concat(tModel.Value.SideEffectInvocationTypeInfos.Keys))
                                                                                                                .Select(type => type.GetAssembly())
                                                                                                                )).CQ
                                                                       , System.Threading.LazyThreadSafetyMode.ExecutionAndPublication);
        }