public void SetUp() { objectRepository = new Dictionary <string, object>(); ReflectionOptimizer.Enable(); var apiCtx = BuildRoutine.Context() .AsClientApplication( codingStyle = BuildRoutine.CodingStyle() .FromBasic() .AddCommonSystemTypes() .AddTypes(GetType().Assembly, t => t.Namespace?.StartsWith("Routine.Test.Performance.Domain") == true) .Use(p => p.ParseableValueTypePattern()) .Initializers.Add(c => c.PublicConstructors().When(type.of <BusinessPerformanceInput>())) .Datas.Add(c => c.Properties(m => !m.IsInherited(true, true))) .DataFetchedEagerly.Set(true) .Operations.Add(c => c.Methods(o => !o.IsInherited(true, true))) .IdExtractor.Set(c => c.IdByProperty(m => m.Returns <int>("Id"))) .Locator.Set(c => c.Locator(l => l.SingleBy(id => objectRepository[id]))) .ValueExtractor.Set(c => c.Value(e => e.By(o => $"{o}"))) ); objectService = apiCtx.ObjectService; rapp = apiCtx.Application; var _ = objectService.ApplicationModel; }
public IClientContext AsClientApplication(ICodingStyle codingStyle) { var coreContext = new DefaultCoreContext(codingStyle, cache); var service = InterceptIfConfigured(new ObjectService(coreContext, cache)); return(new DefaultClientContext(service, new Rapplication(service))); }
public void Caches_domain_types_by_object_model_id() { ICodingStyle codingStyle = BuildRoutine.CodingStyle().FromBasic() .AddTypes(GetType().Assembly, t => !string.IsNullOrEmpty(t.Namespace) && t.Namespace.StartsWith("Routine.Test.Engine.Context.Domain")) .IdExtractor.Set(c => c.IdByProperty(m => m.Returns <string>("Id"))) .Locator.Set(c => c.Locator(l => l.Constant(null))) .ValueExtractor.Set(c => c.Value(e => e.By(obj => $"{obj}"))); var testing = new DefaultCoreContext(codingStyle, new DictionaryCache()); testing.GetDomainTypes(); var domainType = testing.GetDomainType(type.of <CachedBusiness>()); var expected = testing.GetDomainType(domainType.Id); var actual = testing.GetDomainType(domainType.Id); Assert.AreSame(expected, actual); }
public IServiceContext AsServiceApplication(IServiceConfiguration serviceConfiguration, ICodingStyle codingStyle) { var coreContext = new DefaultCoreContext(codingStyle, cache); var service = InterceptIfConfigured(new ObjectService(coreContext, cache)); return(new DefaultServiceContext(coreContext, serviceConfiguration, service)); }