Skip to content

SqlitePropertyBuilderExtensions have wrong generic constraints on PropertyBuilder<T> extensions #4469

@rowanmiller

Description

@rowanmiller

The correct generic is PropertyBuilder<TProperty> (i.e. no constraints on the type of T)

public static PropertyBuilder<TProperty> ForSqlServerHasDefaultValueSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string sql) 
public static PropertyBuilder<TProperty> HasDefaultValueSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string sql) 

However SQLite extensions are defined as PropertyBuilder<TEntity> and TEntity is constrained to a reference type. The T should be renamed and the constraint removed.

public static PropertyBuilder<TEntity> ForSqliteHasDefaultValueSql<TEntity>(this PropertyBuilder<TEntity> builder, string sql) where TEntity : class;

This causes compilation errors if you try to set a default value for SQLite on a property that is a value type.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions