Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8733335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:37:37+00:00 2026-06-13T09:37:37+00:00

Hi was trying to find the ORM with the best performance to use in

  • 0

Hi was trying to find the ORM with the best performance to use in our new project. My final choice became Dapper. We also need to have our application to include the following features (at least) which prevent us from hard coding the SQL queries to pass to Dapper

  1. Database independent
  2. Run time entities definition

I thought about writing an SQL generator for Dapper but I am not sure the approach I am following is the best:

  1. Declare an Interface with methods signature. The implementation corresponds to the Database system to be used (SQL Server/ MySQL/ PostgreSql/ DB2/ Oracle/ etc…).
  2. Create Database XML Schema using the following format:

    <sqltable name="Foo">
        <sqlfield name="ID" primarykey="1" />
        <sqlfield name="Name" />
        <sqlfield name="Surname />
        <sqlfield name="etc" />
        <sqlreference name"KooID" table="Koo" field="ID" />
    </sqltable>
    
  3. Generate classes/entities using the XML provided above (allowing the extension of the schema on runtime). Objects created are POCO.

  4. Implement methods that loop on the properties of the current entity (using reflexion) and generate SQL statements where property is not null:

    String GetInsert(object currentEntity)
    return:
    "INSERT INTO Foo (ID, Name) VALUES (1, 'BooBoo')"
    
  5. The implementation will include at least

    SELECT
    INSERT INTO
    UPDATE
    DELETE
    JOIN /*(using references like the KooID above)*/
    WHERE /*(using filter expressions)*/
    

Can you think of any backwards/disadvantages of this approach? Can you recommend any improvements?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:37:38+00:00Added an answer on June 13, 2026 at 9:37 am

    Using MEF instead of configurations

    What if you’d dismiss all these configurations and just hard code these providers and use MEF to discover which one is included in your application and use that one? Then when you’d be connecting to a different DB you’d write a new provider and replace provider’s assembly? MEF would then do the rest.

    Adding new entities duting production without recompilation

    But as you added a few more details in the comments I would like to say that the way you’re trying to do it is the way to go except I’d introduce a few changes:

    1. Database provider discoverability could still be implemented using MEF so all you’d have to do is drop the provider assembly to your bin folder and your app would use that. This can of course be done by configuration as well. It’s on you to decide how to instantiate correct provider.

    2. Your example database schema seems to have syntax defined by yourself. Maybe rather use something that’s already proven and allows standardised and likely also more complex definition.

    3. Your UI (views or whatever you use) will actually be templates that can consume shcema XML and not POCOs. POCO objects will only deliver data to UI.

    4. As you’ll be using reflection extensivelly in your app it would likely slow it down considerably. I suggest you use better (=faster) approaches. Look at this library on NuGet by Mark Gravell.

    Generating and cosuming design-time unknown entities

    Data entities are going to be unknown during design time (from the perspective of compiled code) because those POCOs are to be generated from XML schema at runtime. Unless your application is purely database oriented (as in direct manipulation of tables in the database) I don’t see how you’ll consume these entities with hardcoded UI?

    As you mention your UI will actually be able to read the same data schema UI and populate it based on POCO instances read from the database. That is all fine as long as it makes sense for your application to be purely data-oriented without additional business rules or user interface processes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok Im still new to Zend, and trying to find how the ORM works
Trying to find out if it's possible to use SQLAlchemy on Heroku. Thanks.
Trying to find the best way of create an overlap/overlay layer to fill the
I don't use DataSets much. Usually find myself using an ORM or just a
I'm getting stuck on a complex query, trying to use Django's ORM. models.py class
I am giving Kohana a try and I was trying to use the ORM
My application runs on JPA/Hibernate, Spring and Wicket. I'm trying to convert our ORM
Trying to find a standard. The CmdLet will process data - multiple input, defined
Trying to find a way to remove blank pages from a document I wrote
Trying to find a good name for a method swapping each coordinate X and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.