Skip to content

IdentityValue should not throw if a compatible value is set into the identity #41

@craigfowler

Description

@craigfowler

Setting Entity<T>.IdentityValue should not throw an exception is a compatible object is specified for the new identity value.

Example

Currently, the cast from object to TIdentity fails if the entity is Entity<long> but an Int32 is specified as the value. Despite it being possible to cast Int32 to Int64 implicitly under other circumstances, this cast fails.

Desired functionality

If the value is compatible with the identity value type, then it should be gracefully converted. This setter should only throw if the new value cannot be converted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions