internal static async Task <ModelTypeAndContextModel> ValidateModelAndGetEFMetadata( CommonCommandLineModel commandLineModel, IEntityFrameworkService entityFrameworkService, IModelTypesLocator modelTypesLocator, string areaName) { ModelType model = ValidationUtil.ValidateType(commandLineModel.ModelClass, "model", modelTypesLocator); ModelType dataContext = ValidationUtil.ValidateType(commandLineModel.DataContextClass, "dataContext", modelTypesLocator, throwWhenNotFound: false); // Validation successful Contract.Assert(model != null, MessageStrings.ValidationSuccessfull_modelUnset); var dbContextFullName = dataContext != null ? dataContext.FullName : commandLineModel.DataContextClass; var modelMetadata = await entityFrameworkService.GetModelMetadata( dbContextFullName, model, areaName); return(new ModelTypeAndContextModel() { ModelType = model, DbContextFullName = dbContextFullName, ContextProcessingResult = modelMetadata }); }
/// <summary> /// Constructor /// </summary> /// <param name="logger"></param> public XbCodeGenerator( IApplicationInfo applicationInfo, IServiceProvider serviceProvider, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ILogger logger ) { try { this._applicationInfo = applicationInfo ?? throw new ArgumentNullException(nameof(applicationInfo)); this._serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); this._modelTypesLocator = modelTypesLocator ?? throw new ArgumentNullException(nameof(modelTypesLocator)); this._entityFrameworkService = entityFrameworkService ?? throw new ArgumentNullException(nameof(entityFrameworkService)); this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); } catch (Exception ex) { this._logger?.LogMessage(Xb.Util.GetErrorHighlighted(ex)); throw ex; } }
public static ModelType ValidateType(string typeName, string argumentName, IModelTypesLocator modelTypesLocator, bool throwWhenNotFound = true) { if (string.IsNullOrEmpty(typeName)) { throw new ArgumentException(string.Format("Please provide a valid {0}", argumentName)); } var candidateModelTypes = modelTypesLocator.GetType(typeName).ToList(); int count = candidateModelTypes.Count; if (count == 0) { if (throwWhenNotFound) { throw new ArgumentException(string.Format("A type with the name {0} does not exist", typeName)); } return(null); } if (count > 1) { throw new ArgumentException(string.Format( "Multiple types matching the name {0} exist:{1}, please use a fully qualified name", typeName, string.Join(",", candidateModelTypes.Select(t => t.Name).ToArray()))); } return(candidateModelTypes.First()); }
public ReadMeGenerator( ICodeGeneratorActionsService codeGeneratorActionsService, IModelTypesLocator modelTypesLocator, ILibraryManager libraryManager, IApplicationEnvironment environment) { if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _libraryManager = libraryManager; _environment = environment; }
public XbAreaGenerator( IApplicationInfo applicationInfo, IServiceProvider serviceProvider, IModelTypesLocator modelTypesLocator, ILogger logger ) { if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } this._serviceProvider = serviceProvider; this._logger = logger; this._appInfo = applicationInfo; this._modelTypesLocator = modelTypesLocator; }
public EntityFrameworkModelProcessor( string dbContextFullTypeName, ModelType modelTypeSymbol, string areaName, ICodeGenAssemblyLoadContext loader, IDbContextEditorServices dbContextEditorServices, IModelTypesLocator modelTypesLocator, Workspace workspace, IProjectContext projectContext, IApplicationInfo applicationInfo, IFileSystem fileSystem, ILogger logger) { if (string.IsNullOrEmpty(dbContextFullTypeName)) { throw new ArgumentException(nameof(dbContextFullTypeName)); } _dbContextFullTypeName = dbContextFullTypeName; _modelTypeSymbol = modelTypeSymbol; _areaName = areaName; _dbContextEditorServices = dbContextEditorServices; _modelTypesLocator = modelTypesLocator; _logger = logger; _loader = loader; _projectContext = projectContext; _applicationInfo = applicationInfo; _fileSystem = fileSystem; _workspace = workspace; _assemblyAttributeGenerator = GetAssemblyAttributeGenerator(); }
public ReadMeGenerator( ICodeGeneratorActionsService codeGeneratorActionsService, IModelTypesLocator modelTypesLocator, IProjectContext projectContext, IApplicationInfo applicationInfo) { if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (projectContext == null) { throw new ArgumentNullException(nameof(projectContext)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _projectContext = projectContext; _applicationInfo = applicationInfo; }
public ReadMeGenerator( ICodeGeneratorActionsService codeGeneratorActionsService, IModelTypesLocator modelTypesLocator, ILibraryManager libraryManager, IApplicationInfo applicationInfo) { if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _libraryManager = libraryManager; _applicationInfo = applicationInfo; }
public static ModelType ValidateType(string typeName, string argumentName, IModelTypesLocator modelTypesLocator, bool throwWhenNotFound = true) { if (string.IsNullOrEmpty(typeName)) { throw new ArgumentException(string.Format(CodeGenerators.Mvc.MessageStrings.ProvideValidArgument, argumentName)); } var candidateModelTypes = modelTypesLocator.GetType(typeName).ToList(); int count = candidateModelTypes.Count; if (count == 0) { if (throwWhenNotFound) { throw new ArgumentException(string.Format(CodeGenerators.Mvc.MessageStrings.TypeDoesNotExist, typeName)); } return null; } if (count > 1) { throw new ArgumentException(string.Format( "Multiple types matching the name {0} exist:{1}, please use a fully qualified name", typeName, string.Join(",", candidateModelTypes.Select(t => t.Name).ToArray()))); } return candidateModelTypes.First(); }
public AdvancedGenerator(IModelTypesLocator modelTypesLocator, IApplicationInfo applicationInfo, IProjectContext projectContext, ICodeGeneratorActionsService codeGeneratorActionsService) { this.modelTypesLocator = modelTypesLocator; this.applicationInfo = applicationInfo; this.projectContext = projectContext; this.codeGeneratorActionsService = codeGeneratorActionsService; }
public ReadMeGenerator( [NotNull]ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull]IModelTypesLocator modelTypesLocator, [NotNull]ILibraryManager libraryManager, [NotNull]IApplicationEnvironment environment) { _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _libraryManager = libraryManager; _environment = environment; }
public ReadMeGenerator( [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment) { _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _libraryManager = libraryManager; _environment = environment; }
public DocumentationGenerator( IModelTypesLocator modelTypesLocator, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILogger logger) : base(PlatformServices.Default.Application) { ModelTypesLocator = modelTypesLocator; ServiceProvider = serviceProvider; CodeGeneratorActionsService = codeGeneratorActionsService; }
// Todo: Instead of each generator taking services, provide them in some base class? // However for it to be effective, it should be property dependecy injection rather // than constructor injection. public ViewGenerator( ILibraryManager libraryManager, IApplicationInfo applicationInfo, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, ILogger logger) : base(applicationInfo) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (entityFrameworkService == null) { throw new ArgumentNullException(nameof(entityFrameworkService)); } if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _libraryManager = libraryManager; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _serviceProvider = serviceProvider; _logger = logger; }
// Todo: Instead of each generator taking services, provide them in some base class? // However for it to be effective, it should be property dependecy injection rather // than constructor injection. public ViewGenerator( ILibraryManager libraryManager, IApplicationEnvironment environment, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, ILogger logger) : base(environment) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (entityFrameworkService == null) { throw new ArgumentNullException(nameof(entityFrameworkService)); } if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _libraryManager = libraryManager; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _serviceProvider = serviceProvider; _logger = logger; }
// Todo: Instead of each generator taking services, provide them in some base class? // However for it to be effective, it should be property dependecy injection rather // than constructor injection. public ViewGenerator( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IEntityFrameworkService entityFrameworkService, [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService) { _libraryManager = libraryManager; _applicationEnvironment = environment; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; }
public ControllerWithContextGenerator( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IEntityFrameworkService entityFrameworkService, [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull] IServiceProvider serviceProvider, [NotNull] ILogger logger) : base(libraryManager, environment, codeGeneratorActionsService, serviceProvider, logger) { ModelTypesLocator = modelTypesLocator; EntityFrameworkService = entityFrameworkService; }
public EntityFrameworkServices( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IAssemblyLoaderEngine loader, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IDbContextEditorServices dbContextEditorServices) { _libraryManager = libraryManager; _environment = environment; _loader = loader; _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; }
public SimpleReportGenerator( IApplicationInfo applicationInfo, IProjectContext projectContext, IModelTypesLocator modelTypesLocator, IFileSystem fileSystem, ILogger logger) { this.applicationInfo = applicationInfo; this.projectContext = projectContext; this.modelTypesLocator = modelTypesLocator; this.fileSystem = fileSystem; this.logger = logger; }
public SecurityTests() { _process = Processes.StartDotNet(); _dataContext = DependencyProvider.ProjectContext(@"..\..\..\..\..\Coalesce.Domain"); IModelTypesLocator typeLocator = DependencyProvider.ModelTypesLocator(_dataContext); ModelType dataModel = ValidationUtil.ValidateType("AppDbContext", "dataContext", typeLocator, throwWhenNotFound: false); _models = ReflectionRepository .AddContext((INamedTypeSymbol)dataModel.TypeSymbol) .Where(m => m.PrimaryKey != null) .ToList(); }
public ControllerWithContextGenerator( ILibraryManager libraryManager, IApplicationEnvironment environment, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, ILogger logger) : base(libraryManager, environment, codeGeneratorActionsService, serviceProvider, logger) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (entityFrameworkService == null) { throw new ArgumentNullException(nameof(entityFrameworkService)); } if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } ModelTypesLocator = modelTypesLocator; EntityFrameworkService = entityFrameworkService; }
public ControllerWithContextGenerator( ILibraryManager libraryManager, IApplicationInfo applicationInfo, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, ILogger logger) : base(libraryManager, applicationInfo, codeGeneratorActionsService, serviceProvider, logger) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (entityFrameworkService == null) { throw new ArgumentNullException(nameof(entityFrameworkService)); } if (codeGeneratorActionsService == null) { throw new ArgumentNullException(nameof(codeGeneratorActionsService)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } ModelTypesLocator = modelTypesLocator; EntityFrameworkService = entityFrameworkService; }
internal static async Task <ModelTypeAndContextModel> ValidateModelAndGetCodeModelMetadata( CommonCommandLineModel commandLineModel, IEntityFrameworkService entityFrameworkService, IModelTypesLocator modelTypesLocator) { ModelType model = ValidationUtil.ValidateType(commandLineModel.ModelClass, "model", modelTypesLocator); Contract.Assert(model != null, MessageStrings.ValidationSuccessfull_modelUnset); var result = await entityFrameworkService.GetModelMetadata(model); return(new ModelTypeAndContextModel() { ModelType = model, ContextProcessingResult = result }); }
// Todo: Instead of each generator taking services, provide them in some base class? // However for it to be effective, it should be property dependecy injection rather // than constructor injection. public ViewGenerator( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IEntityFrameworkService entityFrameworkService, [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull] IServiceProvider serviceProvider, [NotNull] ILogger logger) : base(environment) { _libraryManager = libraryManager; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _serviceProvider = serviceProvider; _logger = logger; }
public EntityFrameworkServices( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IAssemblyLoadContextAccessor loader, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IDbContextEditorServices dbContextEditorServices, [NotNull] IPackageInstaller packageInstaller, [NotNull] ILogger logger) { _libraryManager = libraryManager; _environment = environment; _loader = loader.GetLoadContext(typeof(EntityFrameworkServices).GetTypeInfo().Assembly); _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; _packageInstaller = packageInstaller; _logger = logger; }
// Todo: Instead of each generator taking services, provide them in some base class? // However for it to be effective, it should be property dependecy injection rather // than constructor injection. public ViewGenerator( [NotNull]ILibraryManager libraryManager, [NotNull]IApplicationEnvironment environment, [NotNull]IModelTypesLocator modelTypesLocator, [NotNull]IEntityFrameworkService entityFrameworkService, [NotNull]ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull]IServiceProvider serviceProvider, [NotNull]ILogger logger) { _libraryManager = libraryManager; _applicationEnvironment = environment; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _serviceProvider = serviceProvider; _logger = logger; }
private EntityFrameworkServices GetEfServices(string path, string applicationName, bool useSqlite) { _appInfo = new ApplicationInfo(applicationName, Path.GetDirectoryName(path), "Debug"); _logger = new ConsoleLogger(); _packageInstaller = new Mock <IPackageInstaller>(); _serviceProvider = new Mock <IServiceProvider>(); _projectContext = GetProjectInformation(path); _workspace = new RoslynWorkspace(_projectContext); _loader = new TestAssemblyLoadContext(_projectContext); _modelTypesLocator = new ModelTypesLocator(_workspace); var dbContextMock = new Mock <IDbContextEditorServices>(); var editSyntaxTreeResult = new EditSyntaxTreeResult() { Edited = true }; dbContextMock.Setup(db => db.EditStartupForNewContext(It.IsAny <ModelType>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), useSqlite)) .Returns(editSyntaxTreeResult); var connectionStringsWriter = new Mock <IConnectionStringsWriter>(); connectionStringsWriter.Setup(c => c.AddConnectionString(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())); var filesLocator = new FilesLocator(); var compilationService = new RoslynCompilationService(_appInfo, _loader, _projectContext); var templatingService = new Templating.RazorTemplating(compilationService); _dbContextEditorServices = new DbContextEditorServices(_projectContext, _appInfo, filesLocator, templatingService, connectionStringsWriter.Object); return(new EntityFrameworkServices( _projectContext, _appInfo, _loader, _modelTypesLocator, _dbContextEditorServices, _packageInstaller.Object, _serviceProvider.Object, _workspace, DefaultFileSystem.Instance, _logger)); }
public EntityFrameworkServices( [NotNull]ILibraryManager libraryManager, [NotNull]IApplicationEnvironment environment, [NotNull]IAssemblyLoadContextAccessor loader, [NotNull]IModelTypesLocator modelTypesLocator, [NotNull]IDbContextEditorServices dbContextEditorServices, [NotNull]IPackageInstaller packageInstaller, [NotNull]ILogger logger) { _libraryManager = libraryManager; _environment = environment; _loader = loader.GetLoadContext(typeof(EntityFrameworkServices).GetTypeInfo().Assembly); _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; _packageInstaller = packageInstaller; _logger = logger; }
public ControllerGenerator( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IEntityFrameworkService entityFrameworkService, [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull] ITypeActivator typeActivator, [NotNull] IServiceProvider serviceProvider, [NotNull] ILogger logger) { _libraryManager = libraryManager; _applicationEnvironment = environment; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _typeActivator = typeActivator; _serviceProvider = serviceProvider; _logger = logger; }
public ModelBasedViewScaffolder( IProjectContext projectContext, IApplicationInfo applicationInfo, IModelTypesLocator modelTypesLocator, IEntityFrameworkService entityFrameworkService, ICodeGeneratorActionsService codeGeneratorActionsService, IServiceProvider serviceProvider, ILogger logger) : base(projectContext, applicationInfo, codeGeneratorActionsService, serviceProvider, logger) { if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (entityFrameworkService == null) { throw new ArgumentNullException(nameof(entityFrameworkService)); } _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; }
public static ModelType ValidateType(string typeName, string argumentName, IModelTypesLocator modelTypesLocator, bool throwWhenNotFound = true) { if (string.IsNullOrEmpty(typeName)) { throw new ArgumentException(string.Format(MessageStrings.ProvideValidArgument, argumentName)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } var candidateModelTypes = modelTypesLocator.GetType(typeName).ToList(); int count = candidateModelTypes.Count; if (count == 0) { if (throwWhenNotFound) { throw new ArgumentException(string.Format(MessageStrings.TypeDoesNotExist, typeName)); } return(null); } if (count > 1) { throw new ArgumentException(string.Format( MessageStrings.MultipleTypesMatchingName, typeName, string.Join(",", candidateModelTypes.Select(t => t.Name).ToArray()))); } return(candidateModelTypes.First()); }
public static bool TryValidateType(string typeName, string argumentName, IModelTypesLocator modelTypesLocator, out ITypeSymbol type, out string errorMessage) { errorMessage = string.Empty; type = null; if (string.IsNullOrEmpty(typeName)) { //Perhaps for these kind of checks, the validation could be in the API. errorMessage = string.Format("Please provide a valid {0}", argumentName); return(false); } var candidateModelTypes = modelTypesLocator.GetType(typeName).ToList(); int count = candidateModelTypes.Count; if (count == 0) { errorMessage = string.Format("A type with the name {0} does not exist", typeName); return(false); } if (count > 1) { errorMessage = string.Format( "Multiple types matching the name {0} exist:{1}, please use a fully qualified name", typeName, string.Join(",", candidateModelTypes.Select(t => t.Name).ToArray())); return(false); } type = candidateModelTypes.First(); return(true); }
public EntityFrameworkServices( ILibraryManager libraryManager, ILibraryExporter libraryExporter, IApplicationInfo applicationInfo, ICodeGenAssemblyLoadContext loader, IModelTypesLocator modelTypesLocator, IDbContextEditorServices dbContextEditorServices, IPackageInstaller packageInstaller, IServiceProvider serviceProvider, Workspace workspace, ILogger logger) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (libraryExporter == null) { throw new ArgumentNullException(nameof(libraryExporter)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } if (loader == null) { throw new ArgumentNullException(nameof(loader)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (dbContextEditorServices == null) { throw new ArgumentNullException(nameof(dbContextEditorServices)); } if (packageInstaller == null) { throw new ArgumentNullException(nameof(packageInstaller)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (workspace == null) { throw new ArgumentNullException(nameof(workspace)); } _libraryManager = libraryManager; _libraryExporter = libraryExporter; _applicationInfo = applicationInfo; _loader = loader; _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; _packageInstaller = packageInstaller; _serviceProvider = serviceProvider; _logger = logger; _workspace = workspace; }
public EntityFrameworkServices( ILibraryManager libraryManager, ILibraryExporter libraryExporter, IApplicationEnvironment environment, IAssemblyLoadContextAccessor loader, IModelTypesLocator modelTypesLocator, IDbContextEditorServices dbContextEditorServices, IPackageInstaller packageInstaller, IServiceProvider serviceProvider, ILogger logger) { if (libraryManager == null) { throw new ArgumentNullException(nameof(libraryManager)); } if (libraryExporter == null) { throw new ArgumentNullException(nameof(libraryExporter)); } if (environment == null) { throw new ArgumentNullException(nameof(environment)); } if (loader == null) { throw new ArgumentNullException(nameof(loader)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (dbContextEditorServices == null) { throw new ArgumentNullException(nameof(dbContextEditorServices)); } if (packageInstaller == null) { throw new ArgumentNullException(nameof(packageInstaller)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _libraryManager = libraryManager; _libraryExporter = libraryExporter; _environment = environment; _loader = loader.GetLoadContext(typeof(EntityFrameworkServices).GetTypeInfo().Assembly); _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; _packageInstaller = packageInstaller; _serviceProvider = serviceProvider; _logger = logger; }
public EntityFrameworkServices( IProjectContext projectContext, IApplicationInfo applicationInfo, ICodeGenAssemblyLoadContext loader, IModelTypesLocator modelTypesLocator, IDbContextEditorServices dbContextEditorServices, IPackageInstaller packageInstaller, IServiceProvider serviceProvider, Workspace workspace, IFileSystem fileSystem, ILogger logger) { if (projectContext == null) { throw new ArgumentNullException(nameof(projectContext)); } if (applicationInfo == null) { throw new ArgumentNullException(nameof(applicationInfo)); } if (loader == null) { throw new ArgumentNullException(nameof(loader)); } if (modelTypesLocator == null) { throw new ArgumentNullException(nameof(modelTypesLocator)); } if (dbContextEditorServices == null) { throw new ArgumentNullException(nameof(dbContextEditorServices)); } if (packageInstaller == null) { throw new ArgumentNullException(nameof(packageInstaller)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (workspace == null) { throw new ArgumentNullException(nameof(workspace)); } if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); } _projectContext = projectContext; _applicationInfo = applicationInfo; _loader = loader; _modelTypesLocator = modelTypesLocator; _dbContextEditorServices = dbContextEditorServices; _packageInstaller = packageInstaller; _serviceProvider = serviceProvider; _logger = logger; _workspace = workspace; _fileSystem = fileSystem; }