Closed kuechlerm closed 10 years ago
It works properly, [ColumnOptions] is for table creation only. For other purposes the attribute to use is [QueryOnly]
Tried that, but then you are not able to query, because the IgnoreMe-Column is included in the query.
So why are you adding properties that we'll never get used ? That POCO should be a DTO to get/move data from the db.
I use them, I just don't want to persist them. I wonder why there is an option to "Ignore" properties that makes the DTO useless. Don't get me wrong, I really like SqlFu and I think you have some great features, but this one led me into a trap.
I've put the Ignore property on a create table because someone might need it in a edge case scenario. [QueryOnly] is to avoid the property being used with inserts/updates helpers. SqlFu is a collection of data mapping related tools, you can use one object to create a table and other to query it or to map a db result to. It doesn't aim to be a real ORM.
Like sapiens said, it isn't the best practice to add additional properties to a domain model, but there are always exceptions. However, you can get around your particular issue in sqlfu by changing IgnoreMe to a public member variable instead of a property.
If I define a table like so:
The table gets created properly by the DatabaseTools, but doing a
results in System.Data.SqlClient.SqlException : Invalid column name 'IgnoreMe'.
Any ideas?