Table of Contents

Class ModelBuilderExtensions

Namespace
CloudStorageORM.Extensions
Assembly
CloudStorageORM.dll

Extensions for applying CloudStorageORM model conventions and validation.

public static class ModelBuilderExtensions
Inheritance
ModelBuilderExtensions
Inherited Members

Methods

ApplyBlobSettingsConventions(ModelBuilder)

Applies BlobSettings conventions by computing and storing blob-name annotations for every entity.

public static ModelBuilder ApplyBlobSettingsConventions(this ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

Model builder instance.

Returns

ModelBuilder

The same ModelBuilder for chaining.

Examples

modelBuilder.ApplyBlobSettingsConventions();

Exceptions

InvalidOperationException

Thrown when an entity resolves to an empty blob name.

UseObjectETagConcurrency<TEntity>(EntityTypeBuilder<TEntity>)

Marks the default ETag shadow property as a concurrency token for the entity type.

public static EntityTypeBuilder<TEntity> UseObjectETagConcurrency<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder) where TEntity : class

Parameters

entityTypeBuilder EntityTypeBuilder<TEntity>

Entity type builder.

Returns

EntityTypeBuilder<TEntity>

The same typed EntityTypeBuilder<TEntity> for chaining.

Type Parameters

TEntity

Entity type being configured.

Examples

modelBuilder.Entity<User>().UseObjectETagConcurrency();

UseObjectETagConcurrency<TEntity>(EntityTypeBuilder<TEntity>, Expression<Func<TEntity, string?>>)

Marks a specific string property as the concurrency token used for object ETag checks.

public static EntityTypeBuilder<TEntity> UseObjectETagConcurrency<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, Expression<Func<TEntity, string?>> etagPropertyExpression) where TEntity : class

Parameters

entityTypeBuilder EntityTypeBuilder<TEntity>

Entity type builder.

etagPropertyExpression Expression<Func<TEntity, string>>

Expression selecting the property that stores the ETag value.

Returns

EntityTypeBuilder<TEntity>

The same typed EntityTypeBuilder<TEntity> for chaining.

Type Parameters

TEntity

Entity type being configured.

Examples

modelBuilder.Entity<User>().UseObjectETagConcurrency(x => x.ETag);

Validate(ModelBuilder, IStorageProvider)

Validates the EF model against provider-specific CloudStorageORM rules.

public static ModelBuilder Validate(this ModelBuilder modelBuilder, IStorageProvider provider)

Parameters

modelBuilder ModelBuilder

Model builder instance.

provider IStorageProvider

Storage provider used to choose the proper validation rules.

Returns

ModelBuilder

The same ModelBuilder for chaining.

Examples

modelBuilder.Validate(storageProvider);