コード例 #1
0
 public OperationResult <Dictionary <string, IProviderModel> > Get(GenerationSettings settings, Template template, List <string> includeTheseEntitiesOnly, List <string> excludeTheseEntities)
 {
     //this call won't recreate the SQLServerInfo over multiple calls
     try
     {
         var sqlServerInfo  = _sqlServerInfoFactory.Create(_dataProviderSettings);
         var tables         = TableInfoFactory.Create(sqlServerInfo, settings, includeTheseEntitiesOnly, excludeTheseEntities);
         var sqlTables      = SQLTableFactory.Create(template.Namespace, template.Language, tables);
         var providerModels = new Dictionary <string, IProviderModel>();
         foreach (var sqlTable in sqlTables)
         {
             var sqlModel = SQLModelFactory.Create(sqlTable, settings);
             providerModels.Add(sqlTable.UniqueName, sqlModel);
         }
         return(OperationResult <Dictionary <string, IProviderModel> > .Ok(providerModels));
     }
     catch (System.Exception ex)
     {
         return(new OperationResult <Dictionary <string, IProviderModel> >
         {
             Failure = true,
             Message = $"SQL Database Data Provider had a failure: { ex.Message }\r\n{ ex.StackTrace }",
         });
     }
 }