EntityFramework
This solution is designed for easy development of any application by ASP NetCore EntityFramework in one-context SQL infrastructure.
- The solution implements abstraction, infrastructure, configuration and initial levels.
- Contents: principal EF interfaces (IEntity and INavigation), abstract (mustinherit) class EntityConfig, two classes AppConfigBuilder and SqlDbContext;
- The initial level is based on json-files.
- The product provides components for implementing models, configurating models, configurating applications by applying the file appsetings.json;
5
Does:
building schema of model from Entity Configuration Files;
initializing (if necessary) from individual json-files.
ToDo: install this NugetPackage to application; to implement entities of model by IEntity and INavigation in application; to inherit EntityNameConfig files from EntityConfig; inherit from SqlDbContext if necessary (can be used directly); create instances of entities is NOT necessary, they will be created automatically. Be careful: instances will be created for all configuration files implementing IEntityConfiguration for ALL project assemblies; add global configurations variable to module Program of application, i.e.: public IConfigurationRoot AppConfig (for VB - Public AppConfig As IConfigurationRoot); add configuration to sub Main of Program: var new AppConfigBuilder appconfigbuilder; AppConfig = appconfigbuilder.Build (for VB - Dim appconfibuilder As New AppConfigBuilder : AppConfig = appconfigbuilder.Build). You can to set new settings filename fo appropriate parameter of constructor AppConfigBuilder. But this NOT recommended strongly, filename by default is "appsettings.json"; define ConnectionString in appsettings.json; replace appsettings.json to BaseDirectory of application; for initializing model you can to replace apropriate initials files to BaseDirectory/initials. Filenames must be strongly appropriate entitynames, i.e. Category.json for entity Category; to using database, i.e. Using db = new SqlDbContext(AppConfig,"yourconnectionstringname")