Example #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);
        }
 public static void RegisterDataManagers(IDataManagerContainer dataManagers)
 {
     dataManagers.RegisterDataManager <RIAppDemoServiceEF, CustomerAddressDM, CustomerAddress>(
         dataService => { return(new CustomerAddressDM()); });
     dataManagers.RegisterDataManager <RIAppDemoServiceEF, ProductDM, Product>(
         dataService => { return(new ProductDM()); });
     dataManagers.RegisterDataManager <RIAppDemoServiceEF, LookUpProductDM, LookUpProduct>(
         dataService => { return(new LookUpProductDM()); });
 }
 public RunTimeMetadataBuilder(Type domainServiceType,
                               DesignTimeMetadata designTimeMetadata,
                               IDataHelper dataHelper,
                               IValueConverter valueConverter,
                               IDataManagerContainer dataManagerContainer)
 {
     this.domainServiceType    = domainServiceType;
     this.designTimeMetadata   = designTimeMetadata;
     this.dataHelper           = dataHelper;
     this.valueConverter       = valueConverter;
     this.dataManagerContainer = dataManagerContainer;
 }
 public ServiceOperationsHelper(TService domainService,
                                IDataHelper <TService> dataHelper,
                                IValidationHelper <TService> validationHelper,
                                IDataManagerContainer <TService> dataManagerContainer,
                                IValidatorContainer <TService> validatorsContainer)
 {
     _domainService        = domainService ?? throw new ArgumentNullException(nameof(domainService));
     _dataHelper           = dataHelper ?? throw new ArgumentNullException(nameof(dataHelper));
     _validationHelper     = validationHelper ?? throw new ArgumentNullException(nameof(validationHelper));
     _dataManagerContainer = dataManagerContainer ?? throw new ArgumentNullException(nameof(dataManagerContainer));
     _validatorsContainer  = validatorsContainer ?? throw new ArgumentNullException(nameof(validatorsContainer));
     _dataManagers         = new ConcurrentDictionary <Type, object>();
 }
Example #5
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);
            }
        }