C
C#2y ago
stevon8ter

❔ Which ORM? [query sys.objects, ...]

Hey guys So I already have some decent experience using EF as ORM to create some applications at work. However... I'm about to start working on 1 of my hobby-projects, and I'd really appreciate some help in deciding which ORM to use. Some context about the project, which might help in getting good advice: The project would have its own Database (Master), which would store certain information about another Database (Client) - The question is mainly focused around the Client DB. Let's also assume I wouldn't want to add any tables/views to the Client DB. In order to store (useful) information about the Client, I'd like to query its sys.xxx tables Now the real question... Is there any ORM I could use to query those tables, or should I be looking at writing raw SQL (either using an ORM or not). Any advice (or feedback on why this is a bad idea?) would be greatly appreciated. Thanks in advance Kind regards Steven
9 Replies
jcotton42
jcotton422y ago
I'm fairly confident you can map those to EF just fine Failing that, there's always raw queries
Angius
Angius2y ago
Why multiple databases tho
jcotton42
jcotton422y ago
@stevon8ter
stevon8ter
stevon8ter2y ago
I want my application to access & display a User-given database (user provided connection string for example). I don't want to change anything about the design of the users database, and don't know its structure beforehand.
Angius
Angius2y ago
Ah, some sort of a universal database browser? well, in that case you should probably use Dapper And do SELECT * FROM Table into a Dictionary<string, object>
stevon8ter
stevon8ter2y ago
Yeah kinda, any arguments why I should be using Dapper over EF? I know Dapper is a bit more lightweight, but will it really reflect that much on performance?
Angius
Angius2y ago
EF requires you to know the structure of the database in its entirety Since you want your app to support arbitrary random databases, EF is a bad choice
sunnyp410
sunnyp4102y ago
I would go for Dapper. Used it in may codebases, easy and lightweight to use. It kinda reminds me back in the ADO.NET days 🙂
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.