private static void TestFileCreation(ServiceFactory factory, ICustomizeCodeDomService customizeDom, ICodeGenerationService codeGen, ICodeWriterFilterService filter) { if (!Debugger.IsAttached && !ConfigHelper.GetAppSettingOrDefault("TestFileCreation", false)) { return; } using (var tmp = TempDir.Create()) { var fileName = Path.Combine(tmp.Name, Guid.NewGuid() + ".txt"); try { //factory.Add<ICustomizeCodeDomService>(new CustomizeCodeDomService(new Dictionary<string, string> //{ // { "url", @"https://allegient.api.crm.dynamics.com/XRMServices/2011/Organization.svc"}, // { "namespace", @"Test.Xrm.Entities"}, // { "out", fileName }, // {"servicecontextname", "CrmContext"}, // {"codecustomization", "DLaB.CrmSvcUtilExtensions.Entity.CustomizeCodeDomService,DLaB.CrmSvcUtilExtensions"}, // {"codegenerationservice", "DLaB.CrmSvcUtilExtensions.Entity.CustomCodeGenerationService,DLaB.CrmSvcUtilExtensions" }, // {"codewriterfilter", "DLaB.CrmSvcUtilExtensions.Entity.CodeWriterFilterService,DLaB.CrmSvcUtilExtensions"}, // {"metadataproviderservice:", "DLaB.CrmSvcUtilExtensions.Entity.MetadataProviderService,DLaB.CrmSvcUtilExtensions"}, // {"namingservice", "DLaB.CrmSvcUtilExtensions.NamingService,DLaB.CrmSvcUtilExtensions"}, // {"username", "*****@*****.**"}, // {"password", "*********"} //})); factory.Add(customizeDom); factory.Add(codeGen); factory.Add(filter); factory.Add <INamingService>(new NamingService(factory.GetService <INamingService>())); factory.GetService <ICodeGenerationService>().Write(factory.GetMetadata(), "CS", fileName, "DLaB.CrmSvcUtilExtensions.UnitTest", factory.ServiceProvider); } catch (Exception ex) { // Line for adding a debug breakpoint var message = ex.Message; if (message != null) { throw; } } } }
public CodeCustomization(ICustomizeCodeDomService defaultService) { DefaultService = defaultService; }