public virtual void UpdateName(string newName) { if (DomainMap.GetSourceMap() == this) { DomainMap.Source = newName; } else { foreach (IClassMap classMap in DomainMap.ClassMaps) { if (classMap.GetSourceMap() == this) { classMap.Source = newName; } if (classMap.GetDocSourceMap() == this) { classMap.DocSource = newName; } foreach (IPropertyMap propertyMap in classMap.GetNonInheritedPropertyMaps()) { if (propertyMap.GetSourceMap() == this) { propertyMap.Source = newName; } if (propertyMap.GetDocSourceMap() == this) { propertyMap.DocSource = newName; } } } } m_name = newName; }
public IDomainMap GetMap() { if (this.url.Length < 1) { throw new NPersistException("You must specify an url to your NPersist Web Service in your WebServiceRemotingEngine!"); } RemotingService rs = new RemotingService(this.Context, url); bool doUseCompression = this.useCompression; if (this.compressor == null) { doUseCompression = false; } string result = rs.GetMap(this.domainKey, doUseCompression); if (useCompression && this.compressor != null) { result = this.compressor.Decompress(result); } return(DomainMap.LoadFromXml(result, new DefaultMapSerializer())); }
public IContext GetContext() { if (context == null) { ILoggingService loggingService = engine.GetService <ILoggingService>(); if (loggingService != null) { loggingService.LogInfo(this, "Creating NPersist context"); } IConfigurationService configurationService = engine.GetService <IConfigurationService>(); string path = configurationService.SchemaFilePath; IMapSerializer serialier = new DefaultMapSerializer(); IDomainMap domainMap = DomainMap.Load(path, serialier, false, false); context = new Context(domainMap); GenerateAssembly(context); context.SetConnectionString(configurationService.ConnectionString); context.AutoTransactions = false; } return(context); }
public string Export(DomainMap map) { foreach (var type in map.Mappings.MappedTypes) { var mapping = map.Mappings.For(type); dialect.CreateTable(mapping.Table, x => mapping.ExportTo(dialect)); } return builder.ToString(); }
public string Export(DomainMap map) { foreach (var type in map.Mappings.MappedTypes) { var mapping = map.Mappings.For(type); dialect.CreateTable(mapping.Table, x => mapping.ExportTo(dialect)); } return(builder.ToString()); }
private IContext GetContext(string mapPath) { IMapSerializer serialier = new DefaultMapSerializer(); IDomainMap domainMap = DomainMap.Load(mapPath, serialier, false, false); IContext context = new Context(domainMap); GenerateAssembly(context); return(context); }
private IContext GetContext() { //Assembly asm = this.GetType().Assembly; //string path = "Puzzle.FastForward.Web.Test.npersist"; string path = @"C:\Berlioz\Puzzle\FastForward\Puzzle.FastForward.Web\Test.npersist"; IMapSerializer serialier = new DefaultMapSerializer(); IDomainMap domainMap = DomainMap.Load(path, serialier, false, false); IContext context = new Context(domainMap); GenerateAssembly(context); return(context); }
private void button1_Click(object sender, System.EventArgs e) { IDomainMap domainMap = new DomainMap(); domainMap.Name = "Test"; domainMap.RootNamespace = "Puzzle.Testing"; IClassMap employee = new ClassMap(); employee.Name = "Employee"; employee.DomainMap = domainMap; IPropertyMap firstName = new PropertyMap(); firstName.Name = "FirstName"; firstName.DataType = "System.String"; firstName.ClassMap = employee; IPropertyMap lastName = new PropertyMap(); lastName.Name = "LastName"; lastName.DataType = "System.String"; lastName.ClassMap = employee; IPropertyMap reportsTo = new PropertyMap(); reportsTo.Name = "ReportsTo"; reportsTo.DataType = "Employee"; reportsTo.ClassMap = employee; IPropertyMap employees = new PropertyMap(); employees.Name = "Employees"; employees.IsCollection = true; employees.ItemType = "Employee"; employees.ClassMap = employee; ModelToCodeTransformer modelToCodeTransformer = new ModelToCodeTransformer(); string code = modelToCodeTransformer.ToCSharpCode(domainMap); //string code = modelToCodeTransformer.ToCSharpCodeFile(domainMap, "Test"); //modelToCodeTransformer.ToAssemblyFile(domainMap, domainMap.Name + ".dll"); Assembly asm = modelToCodeTransformer.ToAssembly(domainMap); textBox1.Text = code; }
public IDomainMap GetDomainMap() { if (domainMap == null) { ILoggingService loggingService = engine.GetService <ILoggingService>(); if (loggingService != null) { loggingService.LogInfo(this, "Loading NPersist mapping file."); } IConfigurationService configurationService = engine.GetService <IConfigurationService>(); IMapSerializer serializer = new DefaultMapSerializer(); this.domainMap = DomainMap.Load(configurationService.SchemaFilePath, serializer, false, false); } return(this.domainMap); }
public ISessionFactory Build() { if (dbAdapter == null) { dbAdapter = new NullDbAdapter(); } var domainMap = new DomainMap(dbAdapter); if (domainConfig != null) { domainConfig(domainMap); } domainMap.Done(); if (sessionCacheProvider == null) { sessionCacheProvider = () => new SessionCache(); } return new SessionFactory(connString, dbAdapter, domainMap, sessionCacheProvider); }
public void SetUp() { map = new DomainMap(); }
public static void Configure(params IEntityMap[] entityMaps) { Map = new DomainMap(entityMaps); }
public void SetUp() { map = new DomainMap(); }
public InsertCommand(DomainMap domainMap) { this.domainMap = domainMap; }
public static void Convert(string sourceFileName, string targetFileName, IMapSerializer sourceMapSerializer, IMapSerializer targetMapSerializer) { IDomainMap domainMap = DomainMap.Load(sourceFileName, sourceMapSerializer); domainMap.Save(targetFileName, targetMapSerializer); }