public void ManageWithAdventureWorks2014()
 {
     var diagnosticsCallback = new RelayDiagnosticsCallback();
     var projection          = ProjectionBuilder.Build(diagnosticsCallback,
                                                       "AdventureWorks2014.xml",
                                                       Constants.AdventureWorks2014ConnectionString);
 }
 public async Task ManageWithZaharAsync()
 {
     var diagnosticsCallback = new RelayDiagnosticsCallback();
     var projection          = await ProjectionBuilder.BuildAsync(diagnosticsCallback,
                                                                  "Zahar.xml",
                                                                  Constants.UseCaseDbConnectionString);
 }
Exemple #3
0
        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());
        }
Exemple #4
0
 public static Projection Build(IDiagnosticsCallback diagnosticsCallback, string mappingFile, string connectionString)
 {
     return(ProjectionBuilder.BuildAsync(diagnosticsCallback, mappingFile, connectionString).GetAwaiter().GetResult());
 }