0

Everything else about this micro ORM looks great, except I can't figure out how to map column name, like

[Column("db_username")]
public string UserName {get;set;}

Did I miss something? Thanks

MikeSW
  • 16,140
  • 3
  • 39
  • 53
Whoever
  • 1,295
  • 1
  • 14
  • 21

1 Answers1

2

You can't do that, SqlFu is a data mapper, mapping a query result to a poco. The attributes used to decorate a Poco are for table creation only and not for querying. So, there's no mapping in an ORM sense.

MikeSW
  • 16,140
  • 3
  • 39
  • 53
  • 1
    Thanks for the follow up. You are the author, right? But why not? We don't always have control over the query. What if dba hands you over a stored proc that doesn't match your poco? I like everything about SqlFu, except I need some kind of tweaking about the column names. All micro ORM does it. Any particular reasons why it can't be done? Thanks – Whoever Apr 16 '14 at 13:46
  • I know that SqlFu is confusing at the moment (the next version I'm planing will be much more clear in its intent) the point is the POCO is a mapping destination of whatever query you have. It's not about associating a poco with a table or query. The POCO and query are independent so you can define a poco to match the query results or use dynamic. About other micro-ORMs I'm not that sure everyone does mapping the ORM way, a micro-ORM is pretty much a data mapper on steroids (with strongly typed helpers). It's about skipping the boring repeating parts, NOT abstracting the db. – MikeSW Apr 16 '14 at 13:57
  • Thanks, it's an honor talking to you smart folks once a while. You seems to be only one out there still active on the topic, maybe you have some bigger plans. The thing is, when you have something like db.Update().Set(p=>p.IsActive,false).Where(p=>p.Id==12).Execute(); but with no control over Post vs the underlying storage, it's really set a hard limit. If it's in the way of your main goal, maybe some plugin or fluent type of mapping on the side? Or maybe SqlFu is something entirely different? The next big thing? ^_^ Looking forward to it. – Whoever Apr 16 '14 at 14:15
  • 2
    For v3 I'm planning a more common mapping i.e associating a POCO with a table and then work directly with the POCO (as the table representative) for querying via expression and hopefully a fluent strongly typed query builder (not linq). The paradigm will be think in SQL, write C# (an ORM allows you to think OOP and forget about SQL). – MikeSW Apr 16 '14 at 14:23