Skip to content

It's not possible to use a string PK #1

Closed

Description

@caesay

By default, Asp.net identity uses string PK data types (guids). There are lots of good reasons for doing so as long as you don't need a clustered index, but it's impossible to do so with this library because it wraps the columns with a nullable operator.

Example:

public interface IModificationAuditable<TUserId> : IModificationTrackable where TUserId : struct
{
    TUserId? UpdaterUserId { get; set; }
}

If TUserId in the above sample is string, then it's impossible to declare a property which will satisfy the interface.

Activity

  1. gnaeus commented on Jan 19, 2018

    @gnaeus
    Owner

    Thanks for your reply!

    The library already contains an interface IModificationAuditable for this case:

    interface IModificationAuditable : IModificationTrackable
    {
        string UpdaterUser { get; set; }
    }

    Уou are right. It's field string UpdaterUser { get; set; } should be named UpdaterUserId.

    And we need these three interfaces:

    interface ICreationAuditable : ICreationTrackable
    {
        string CreatorUserId { get; set; }
    }
    interface IModificationAuditable : IModificationTrackable
    {
        string UpdaterUserId { get; set; }
    }
    public interface IDeletionAuditable : IDeletionTrackable
    {
        string DeleterUserId { get; set; }
    }

    But I do't know how to implement this without breaking changes.

  2. gnaeus commented on Mar 23, 2018

    @gnaeus
    Owner

    @caesay, I create version 2.0 of the library. It supports EFCore 2.0 and EntityFramework 6.2.
    And also, I fix signatures of auditable entitiy interfaces:

    interface ICreationAuditable : ICreationTrackable
    {
        string CreatorUserId { get; set; }
    }
    
    interface IModificationAuditable : IModificationTrackable
    {
        string UpdaterUserId { get; set; }
    }
    
    public interface IDeletionAuditable : IDeletionTrackable
    {
        string DeleterUserId { get; set; }
    }

    So we can use it with ASP.NET Identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions