public string Create() { var schema = _schemaReader.Read(); // create a process based on the schema var process = new Process { Name = "JunkDrawer" }.WithDefaults(); process.Connections.Clear(); process.Connections.Add(schema.Connection.Clone()); process.Connections.Add(_cfg.Output()); process.Entities = schema.Entities; foreach (var entity in process.Entities) { entity.PrependProcessNameToOutputName = false; entity.CalculateHashCode = _cfg.CalculateHashCode; } if (!string.IsNullOrEmpty(_cfg.Output().Table) && _cfg.Output().Table != Constants.DefaultSetting) { process.Entities.First().Alias = _cfg.Output().Table; } process.Mode = "init"; return(process.Serialize()); }
public string Create() { var schema = _schemaReader.Read(); // create a process based on the schema var process = new Process { Name = "JunkDrawer" }; process.Connections.Add(schema.Connection.Clone()); process.Connections.Add(_cfg.Output()); process.Entities = new List <Entity> { schema.Entities.First() }; var entity = process.Entities.First(); entity.PrependProcessNameToOutputName = false; if (!string.IsNullOrEmpty(_cfg.Output().Table) && _cfg.Output().Table != Constants.DefaultSetting) { entity.Alias = _cfg.Output().Table; } process.Mode = "init"; // sqlce does not support views if (_cfg.Output().Provider == "sqlce") { process.Flatten = true; process.Flat = entity.Alias; } return(process.Serialize()); }
public int ToKey(Cfg cfg) { unchecked { var hash = 17; var input = cfg.Input(); var output = cfg.Output(); hash = hash * 23 + input.MinLength.GetHashCode(); hash = hash * 23 + input.MaxLength.GetHashCode(); hash = hash * 23 + Provider?.GetHashCode() ?? output.Provider.GetHashCode(); hash = hash * 23 + Server?.GetHashCode() ?? output.Server.GetHashCode(); hash = hash * 23 + Database?.GetHashCode() ?? output.Database.GetHashCode(); hash = hash * 23 + Schema?.GetHashCode() ?? output.Schema.GetHashCode(); hash = hash * 23 + View?.GetHashCode() ?? output.Table.GetHashCode(); hash = hash * 23 + Math.Max(Port, output.Port).GetHashCode(); hash = hash * 23 + DatabaseFile?.GetHashCode() ?? output.File.GetHashCode(); hash = hash * 23 + FileInfo.FullName.GetHashCode(); hash = hash + 23 + FileInfo.LastWriteTimeUtc.GetHashCode(); return(hash); } }