Skip to content

Latest commit

 

History

History
91 lines (58 loc) · 2.47 KB

README.md

File metadata and controls

91 lines (58 loc) · 2.47 KB

Aranasoft.Cobweb.EntityFramework.Validation

Azure DevOps

Schema validation and testing components for Entity Framework Core.

Cobweb was created by Arana Software, a software agency in Las Vegas, Nevada.

Installation

From Package Manager Console:

PM> install-package aranasoft.cobweb.entityframeworkcore.validation

From .NET CLI:

> dotnet add package aranasoft.cobweb.entityframeworkcore.validation

Usage

// using Aranasoft.Cobweb.EntityFrameworkCore.Validation

myApplicationContext.ValidateSchema([options]);

ValidateSchema requires that the DbContext uses an Application Service Provider configured with platform-specific design time services.

Example:

  var serviceCollection = new ServiceCollection().AddEntityFrameworkDesignTimeServices();
  new SqlServerDesignTimeServices().ConfigureDesignTimeServices(serviceCollection);
  var serviceProvider = serviceCollection.BuildServiceProvider();

  var builder = new DbContextOptionsBuilder<ApplicationDbContext>();
  builder.UseSqlServer(myConnection);
  builder.UseApplicationServiceProvider(serviceProvider);

  var myApplicationContext = new ApplicationDbContext(builder.Options);

Options

// using Aranasoft.Cobweb.EntityFrameworkCore.Validation

var options = new SchemaValidationOptions{
                      ValidateIndexes = true,
                      ValidateForeignKeys = true
                  };

ValidateIndexes

Type: boolean
Default: true

Set to false to skip validation of indexes.

ValidateForeignKeys

Type: boolean
Default: true

Set to false to skip validation of foreign keys. Useful for platforms that do no use foreign keys.

ValidateNullabilityForTables

Type: boolean
Default: true

Set to false to skip validation of nullability on table columns.

ValidateNullabilityForViews

Type: boolean
Default: false

Set to false to skip validation of nullability on view columns. By default, many database platforms enable nullability on view columns regardless of nullability on the underlying table column.

This option is not applicable to Entity Framework Core 2.x or Aranasoft.Cobweb.EntityFrameworkCore.Validation 1.2x.x.

License

Cobweb is copyright of Arana Software, released under the BSD License.