sapiens/SqlFu

Propeties with getters should not be included in the query

Closed this issue · 3 comments

Sometimes you need to extend your object with computed properties, to conform with an interface for instance. This columns with just getters should not be included in queries.

Either that or a ignore attribute to remove that property from all queries

This is an easy fix:
Line 72 of SqlFu.Internals.TableInfo:

Columns = t.GetProperties().Where(i=>i.CanWrite).Select(p => p.Name).ToArray();

Let me know if there is interest and I will do a pull request

The problem is, some people expect mapping to private setters. The best would be to be ignored only if the property has a [Ignore]. Right now, you can specify ignore only as column definition feature used for table generation. I think the behaviour you want should be implemented explicitely with an Ignore attribute. If you go on this route, I'd be interested in a pull request.

Excellent, I will re-use the same [Ignore] now used for the table generation