jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

Multiple recordsets and one-to-one relationship #499

Closed avber closed 1 year ago

avber commented 1 year ago

I have the User entity ` public class User { public Guid Id { get; set; } public List Organizations { get; set; } public List Subscriptions { get; set; } }

public class UserSubscription
{
    public Guid ID { get; set; }
    public string Name { get; set; }
    public string Url { get; set; }
    public string Description { get; set; }
    public bool Active { get; set; }
    [JsonIgnore]
    public Database Database { get; set; }
}

`

When I try to get it via Auto Interface implementation, the Organizations property is correctly mapped.

The problem is with UserSubscription.Database (not filled in). Other properties are correctly mapped and Database columns contain data.

public interface IUserRepository { [Sql(@" SELECT @userID AS ID; SELECT ................ WHERE ou.UserID = @userID; SELECT s.[ID] ................. WHERE ou.UserID = @userID; ")] [Recordset(1, typeof(Organization), IsChild = true, Into = "Organizations")] [Recordset(2, typeof(UserSubscription), typeof(Database), IsChild = true, Into = "Subscriptions")] User GetById(Guid userId); }

What should I change in [Recordset(2)] ?

Thanks

avber commented 1 year ago

Never mind, my mistake