public StoredProcedureRtt( ProcedureInfo procedureInfo, IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) : base(diagnosticsCallback, formatInfo) { Procedure = procedureInfo; }
internal ProjectionBuilder( ICatalogReader catalogReader, IMappingReader mappingReader, IDiagnosticsCallback diagnosticsCallbackProxy) { _catalogReader = catalogReader; _mappingReader = mappingReader; _diagnosticsCallbackScope = new DiagnosticsCallbackScope(diagnosticsCallbackProxy); }
public DiagnosticsCallbackScope(IDiagnosticsCallback callback, string messagePrefix = null) { if (ReferenceEquals(callback, null)) { throw new ArgumentNullException(nameof(callback)); } m_innerCallback = callback; m_messagePrefix = string.IsNullOrWhiteSpace(messagePrefix) ? null : messagePrefix; }
public CmdBuilderFactoryRtt( IEnumerable <ProcedureInfo> procedures, IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) : base(diagnosticsCallback, formatInfo) { procedures = procedures ?? Enumerable.Empty <ProcedureInfo>(); Procedures = procedures.OrderBy(sp => sp.FullName, StringComparer.Ordinal).ToList(); SpFullNames = Procedures.Select(sp => sp.FullName).ToList(); }
public UserDefinedTableTypeRtt( DataTable schema, IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) : base(diagnosticsCallback, formatInfo) { if (ReferenceEquals(schema, null)) { throw new ArgumentNullException(nameof(schema)); } Schema = schema; }
protected RuntimeTextTemplate(IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) { if (ReferenceEquals(diagnosticsCallback, null)) { throw new ArgumentException(nameof(diagnosticsCallback)); } if (ReferenceEquals(diagnosticsCallback, null)) { throw new ArgumentException(nameof(formatInfo)); } m_diagnosticsCallback = diagnosticsCallback; m_formatInfo = formatInfo; }
public static async Task <Projection> BuildAsync(IDiagnosticsCallback diagnosticsCallback, string mappingFile, string connectionString) { SqlConnection connection = null; try { connection = new SqlConnection(connectionString); } catch (InvalidOperationException) { throw new ConnectionStringFormatException(connectionString); } var diagnosticsCallbackScope = new DiagnosticsCallbackScope( diagnosticsCallback, $"{Path.GetFileName(mappingFile)} <-> [{connection.DataSource}].[{connection.Database}] >"); var catalogReader = new CatalogReader(connectionString, diagnosticsCallback); var mappingReader = new MappingReader(mappingFile, diagnosticsCallback); var modelReader = new ProjectionBuilder(catalogReader, mappingReader, diagnosticsCallbackScope); return(await modelReader.BuildAsync()); }
public CatalogReader(string connectionString, IDiagnosticsCallback diagnosticsCallback) { string pattern = Regex.Replace(@"(?:xis);? Max Pool Size\s*=\s*\d+ |;?$", @"\s+", @"\s+"); connectionString = Regex.Replace(connectionString, pattern, ";Max Pool Size=10"); m_connectionString = connectionString; try { var connection = new SqlConnection(connectionString); DataSource = connection.DataSource; Database = connection.Database; m_diagnosticsCallback = new DiagnosticsCallbackScope(diagnosticsCallback, $"[{DataSource}].[{Database}] > "); //TODO: verify sever version using (connection) { connection.Open(); } } catch (SqlException ex) { var message = new StringBuilder($"Could not reach the {Database} database on server {DataSource}."); if (ex.Number == 18487 || ex.Number == 18488) { message.Append(" The specified password has expired or must be reset."); } else { message.Append(" Make sure that the connection string specified in Transaction Script Code Generating tool is valid"); message.Append($" and also that the {DataSource} SQL Server instance is up and running."); } m_diagnosticsCallback.Error(message.ToString()); throw new DatabaseNotAccessibleException(); } catch (ArgumentException) { var message = new StringBuilder("Invalid connection string.") .Append($" Connection string: \"{m_connectionString}\""); m_diagnosticsCallback.Error(message.ToString()); throw new ConnectionStringFormatException(connectionString); } }
public RuntimeTextTemplateFactory( Projection.Projection projection, IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) { if (ReferenceEquals(projection, null)) { throw new ArgumentException(nameof(projection)); } if (ReferenceEquals(diagnosticsCallback, null)) { throw new ArgumentException(nameof(diagnosticsCallback)); } if (ReferenceEquals(diagnosticsCallback, null)) { throw new ArgumentException(nameof(formatInfo)); } m_projection = projection; m_diagnosticsCallback = diagnosticsCallback; m_formatInfo = formatInfo; }
protected SchemaValidatingXmlSerializer( string schemaXmlString, IDiagnosticsCallback diagnosticsCallback) { var schema = XmlSchema.Read(new StringReader(schemaXmlString), (e, a) => { if (a.Severity == XmlSeverityType.Error) { throw new InvalidOperationException(); } }); m_serializer = new XmlSerializer(typeof(T)); m_diagnosticsCallbackScope = new DiagnosticsCallbackScope(diagnosticsCallback); var schemas = new XmlSchemaSet(); schemas.Add(schema); m_settings = new XmlReaderSettings { Schemas = schemas, ValidationType = ValidationType.Schema, ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints | XmlSchemaValidationFlags.ReportValidationWarnings }; m_settings.ValidationEventHandler += delegate(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Error) { this.OnError(args.Message); m_schemaErrorsCount++; } else if (args.Severity == XmlSeverityType.Warning) { this.OnWarning(args.Message); } }; }
public MappingReader(string filePath, IDiagnosticsCallback diagnosticsCallback) { m_filePath = filePath; m_diagnosticsCallback = new DiagnosticsCallbackScope(diagnosticsCallback, $"{Path.GetFileName(filePath)} >"); }
public CommonRtt(IDiagnosticsCallback diagnosticsCallback, IFormatInfo formatInfo) : base(diagnosticsCallback, formatInfo) { }
public static Projection Build(IDiagnosticsCallback diagnosticsCallback, string mappingFile, string connectionString) { return(ProjectionBuilder.BuildAsync(diagnosticsCallback, mappingFile, connectionString).GetAwaiter().GetResult()); }
public MappingSerializer(IDiagnosticsCallback host) : base(Resources.Zahar_SqlClient, host) { }