Esempio n. 1
0
        public static RunTimeMetadata GetInitializedMetadata(BaseDomainService domainService,
                                                             IDataHelper dataHelper,
                                                             IValueConverter valueConverter)
        {
            RunTimeMetadata result = _metadataCache.GetOrAdd(domainService.GetType(), (svcType) =>
            {
                RunTimeMetadata runTimeMetadata = null;

                try
                {
                    DesignTimeMetadata designTimeMetadata      = ((IMetaDataProvider)domainService).GetDesignTimeMetadata(false);
                    IDataManagerContainer dataManagerContainer = domainService.ServiceContainer.DataManagerContainer;
                    runTimeMetadata = _InitMetadata(domainService, designTimeMetadata, dataHelper, valueConverter, dataManagerContainer);
                }
                catch (Exception ex)
                {
                    domainService._OnError(ex);
                    throw new DummyException(ex.Message, ex);
                }

                return(runTimeMetadata);
            });

            return(result);
        }
Esempio n. 2
0
        private static CachedMetadata InitMetadata(BaseDomainService domainService)
        {
            EventHandler <RegisteredDMEventArgs> fn_regDM = (sender, e) => {
                ProcessMethodDescriptions(domainService.ServiceContainer, e.DataManagerType, (CachedMetadata)sender);
            };

            CachedMetadata cachedMetadata = new CachedMetadata();

            //called on every data manager registered while bootstrapping
            cachedMetadata.RegisteredDM += fn_regDM;
            try
            {
                InitCachedMetadata(domainService, cachedMetadata);
            }
            catch (Exception ex)
            {
                domainService._OnError(ex);
                throw new DummyException(ex.Message, ex);
            }
            finally
            {
                cachedMetadata.RegisteredDM -= fn_regDM;
                cachedMetadata.InitCompleted();
            }

            return(cachedMetadata);
        }
Esempio n. 3
0
        private static RunTimeMetadata _InitMetadata(BaseDomainService domainService,
                                                     DesignTimeMetadata designTimeMetadata,
                                                     IDataHelper dataHelper,
                                                     IValueConverter valueConverter,
                                                     IDataManagerContainer dataManagerContainer)
        {
            RunTimeMetadataBuilder runTimeMetadataBuilder = new RunTimeMetadataBuilder(domainService.GetType(), designTimeMetadata, dataHelper, valueConverter, dataManagerContainer);

            try
            {
                return(runTimeMetadataBuilder.Build());
            }
            catch (Exception ex)
            {
                domainService._OnError(ex);
                throw new DummyException(ex.Message, ex);
            }
        }