Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

How to map nested classes #467

Open
Open

Description

@frankiDotNet

I could not find anything about mapping calsses that contains sub classes.

[Table("TableA")]
public class ClassA{

[COLUMN("B_ID")]
public BId {get; set;}

[COLUMN("b")]
public ClassB b{get; set;}
}

[Table("TableB")]
public class ClassB{

[COLUMN("ID")]
public Int32 Id{get; set;}
}

How to get this e.g. with a join or how do I load class A with nested B objects, that could have relations like one to one or one to many ?

Activity

  1. TrevorPilley commented on Mar 14, 2017

    @TrevorPilley
    Collaborator

    This isn't currently supported in MicroLite, it's something I'm considering for MicroLite 7.0 but for now you will need to do that additional fetch yourself (the upside is you can choose if & when that occurs) using the Include API

  2. frankiDotNet commented on Mar 14, 2017

    @frankiDotNet
    Author

    Ok, sorry for the late response, had to recover from the shock ;-) I didn't think about it is not possible in this way. Ok if I use includes, is it possible to log all db sql queries that are made(nlog). So that I can see what is really happening at db level?
    I know this question is not helping but do you have release date for the version 7? And will there be a breaking change in this behaviour?

  3. TrevorPilley commented on Mar 14, 2017

    @TrevorPilley
    Collaborator

    All that happens is 2 or more individual queries are sent to the database server as a single request over a single connection and the results are returned in separate datasets which are then parsed into objects and made available to the caller.

    As far as logging the traffic, queries aren't written to the log to avoid sensitive data being stored but you can use something like the profiler in MS SQL Server to see what requests are made.

  4. TrevorPilley commented on Mar 14, 2017

    @TrevorPilley
    Collaborator

    There's no firm time frame for 7.0 at the moment, I'm finishing the OData 4.0 work in the WebApi extension before I pick up on 7.0.

    There may well be breaking changes in 7.0 but those will be detailed in the release notes and on the blog once known.

  5. frankiDotNet commented on Mar 15, 2017

    @frankiDotNet
    Author

    Thanks for the reply and for the detailed information. I appreciate your project, and I try to avoid entity framework as long as I can, but need a good alternative. I think yours is getting more a really good one.
    Last thing before I close the issue (question).
    I asked about logging each sql query that is applied to the db, is this possible?

  6. TrevorPilley commented on Mar 15, 2017

    @TrevorPilley
    Collaborator

    Not in MicroLite itself, the standard way to do that is with the profiling tools that are part of the database server e.g. SQL Server Profiler

  7. added this to the 8.0 milestone on Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions