protected override void PrepareSchema() { NotifyBatchSize = (int)LogRows; BatchSize = _batchSize; var fromFields = new Fields(_entity.Fields, _entity.CalculatedFields).WithOutput().AddBatchId(_entity.Index, false); if (_entity.IsMaster() && _entity.Delete) fromFields.AddDeleted(_entity.Index, false); foreach (var field in fromFields) { Schema[field.Alias] = field.SystemType; } var toFields = new SqlServerEntityAutoFieldReader().Read(Connection, _entity.ProcessName, _entity.Prefix, _entity.OutputName(), string.Empty, _entity.IsMaster()); foreach (var from in fromFields) { if (toFields.HaveField(from.Alias)) { var to = toFields.Find(from.Alias).First(); if (!to.SimpleType.Equals(from.SimpleType)) { if (!to.SimpleType.Equals("byte[]") && from.SimpleType.Equals("rowversion")) { throw new TransformalizeException(Logger, EntityName, "{0} has a matching {1} fields, but different types: {2} != {3}.", TargetTable, from.Alias, from.SimpleType, to.SimpleType); } } } else { throw new TransformalizeException(Logger, EntityName, "{0} does not have a matching {1} field.", TargetTable, from.Alias); } } }
protected override void PrepareSchema() { NotifyBatchSize = (int)LogRows; BatchSize = _batchSize; var fromFields = new Fields(_entity.Fields, _entity.CalculatedFields).WithOutput().AddBatchId(_entity.Index, false); if (_entity.IsMaster() && _entity.Delete) { fromFields.AddDeleted(_entity.Index, false); } foreach (var field in fromFields) { Schema[field.Alias] = field.SystemType; } var toFields = new SqlServerEntityAutoFieldReader().Read(Connection, _entity.ProcessName, _entity.Prefix, _entity.OutputName(), string.Empty, _entity.IsMaster()); foreach (var from in fromFields) { if (toFields.HaveField(from.Alias)) { var to = toFields.Find(from.Alias).First(); if (!to.SimpleType.Equals(from.SimpleType)) { if (!to.SimpleType.Equals("byte[]") && from.SimpleType.Equals("rowversion")) { throw new TransformalizeException(Logger, EntityName, "{0} has a matching {1} fields, but different types: {2} != {3}.", TargetTable, from.Alias, from.SimpleType, to.SimpleType); } } } else { throw new TransformalizeException(Logger, EntityName, "{0} does not have a matching {1} field.", TargetTable, from.Alias); } } }