VistaDB 6
VistaDB / Tools User's Guide / Data Builder / Context Sensitive Screens / LINQ Query Pane / LINQ Entity Model Tab
In This Topic
    LINQ Entity Model Tab
    In This Topic

    The Entity Model tab shows information after a model has been generated. The tree shows each of the entities and their properties.

    Scripting

    Right clicking on an entity (the table name) will allow you to generate some default LINQ queries for the Query pane.

    Only C# code is supported in the current version.

    Each of the basic CRUD operations are demonstrated for the object. Selecting them will put the script in the query window.

    See the LINQ Script Examples topic for more information.

    Putting queries into your code

    Once you have a query working the way you want, you can copy and paste it into your code. The only requirements are that you have a model that matches the default model, and that you have a data context of your model called context (or you can rename the internal context to be what your variable is named).

    A best practice for this code might look something like this:

    Using Entity Framework
    Copy Code
    using( RealModel.ModelEntities context = new RealModel.ModelEntities(connection)) { var query = from i in context.OrderDetails select new { i.OrderID, i.Orders.OrderDate }; // Your custom code to work with the LINQ results } 
    
    See Also