Editor.NET - MJoin + LeftJoin data?

Editor.NET - MJoin + LeftJoin data?

washuit-iammwashuit-iamm Posts: 133Questions: 55Answers: 2

I have fixed this bug in Editor.NET https://datatables.net/forums/discussion/78882/editor-net-mjoin-leftjoin#latest

But I have yet to PR it, as I cant seem to get the LeftJoin data.

For example:


public class InventoryServerModel { public class InventoryServer { public string? Name { get; set; } } } public class Warranty { public string CertificateNumber { get; set; } // !!! // How to populate??? // !!! public class InventoryServerWarrantyProvider { public string Name { get; set; } } } var editor = new Editor(db, "InventoryServer", "Id") .Model<InventoryServerModel>() .Field(new Field("InventoryServer.Id").Set(false)) // Id is DB autogenerated .MJoin(new MJoin("InventoryServerWarranty") .Set(false) .Link("InventoryServer.Id", "InventoryServerInventoryServerWarrantyLine.InventoryServerId") .Link("InventoryServerWarranty.Id", "InventoryServerInventoryServerWarrantyLine.InventoryServerWarrantyId") .Order("InventoryServerWarranty.CertificateNumber") .Model<Warranty>() .LeftJoin("InventoryServerWarrantyProvider", "InventoryServerWarrantyProvider.Id", "=", "InventoryServerWarranty.InventoryServerWarrantyProviderId") )

Answers

  • washuit-iammwashuit-iamm Posts: 133Questions: 55Answers: 2

    This finally did it:

                    .MJoin(new MJoin("InventoryServerWarranty")
                        .Model<InventoryServerWarranty>()
                        .Field(new Field("InventoryServerWarrantyProvider.Name"))
                        .Field(new Field("InventoryServerWarrantyProvider.Description"))
                        .Set(false)
                        .Link("InventoryServer.Id", "InventoryServerInventoryServerWarrantyLine.InventoryServerId")
                        .Link("InventoryServerWarranty.Id", "InventoryServerInventoryServerWarrantyLine.InventoryServerWarrantyId")
                        .Order("InventoryServerWarranty.CertificateNumber")
                        .LeftJoin("InventoryServerWarrantyProvider", "InventoryServerWarrantyProvider.Id", "=", "InventoryServerWarranty.InventoryServerWarrantyProviderId")
                    )
    

    IE manually adding the fields .Field(new Field("InventoryServerWarrantyProvider.Name")) why did it not do that for me? Seems to work fine for the linked table, but not the LeftJoin.

Sign In or Register to comment.