Пример #1
0
 public ModelInfoImpl(
     CompositeModel model,
     PublicCompositeTypeGenerationResult types,
     CollectionsFactory collectionsFactory
     )
 {
     this._model = model;
     this._types = types;
     this._compositeMethodAttributeHolders = collectionsFactory.NewListProxy(
         model.Methods
         .Select(cMethod => (AttributeHolder) new AttributeHolderImpl(collectionsFactory, cMethod.GetAllMethodModels().Select(mModel => mModel.NativeInfo)))
         .ToList()
         ).CQ;
 }
        public ModelInfoContainerImpl(
            DictionaryQuery <CompositeModelType, CompositeModelTypeInstanceScopeSupport> modelSupport,
            SetQuery <CompositeModel> models,
            ApplicationValidationResultIQ validationResult,
            DictionaryQuery <CompositeModel, PublicCompositeTypeGenerationResult> loadingResults,
            CollectionsFactory collectionsFactory,
            Type genericPropertyMixinType,
            Type genericEventMixinType
            )
        {
            ArgumentValidator.ValidateNotNull("Model support", modelSupport);
            ArgumentValidator.ValidateNotNull("Models", models);
            ArgumentValidator.ValidateNotNull("Validation result", validationResult);

            PublicCompositeTypeGenerationResult[] typeGenResults = new PublicCompositeTypeGenerationResult[models.Count];
            Int32 gIdx = 0;

            foreach (CompositeModel model in models)
            {
                typeGenResults[gIdx] = loadingResults[model];
                ++gIdx;
            }

            this._compositeModels = collectionsFactory.NewDictionaryProxy <CompositeModelType, SetQuery <CompositeModelInfo> >(
                models
                .Select(model => model.ModelType)
                .Distinct()
                .ToDictionary(
                    modelType => modelType,
                    modelType2 =>
                    collectionsFactory.NewSetProxy <CompositeModelInfo>(new HashSet <CompositeModelInfo>(models
                                                                                                         .Select((modelInner, idx) => new KeyValuePair <CompositeModel, PublicCompositeTypeGenerationResult>(modelInner, typeGenResults[idx]))
                                                                                                         .Where(kvp => kvp.Key.ModelType.Equals(modelType2))
                                                                                                         .Select(kvp => new ModelInfoImpl(kvp.Key, kvp.Value, collectionsFactory)),
                                                                                                         ReferenceEqualityComparer <CompositeModelInfo> .ReferenceBasedComparer)).CQ
                    )
                ).CQ;
        }