Want to ignore a column, maby should expose Data property in builder interface?
Closed this issue · 3 comments
I need to exclude a column from CreateTableFrom<T>(..)
The previous versions I would have attributed the type to exclude the members i don't want but that doesn't follow through into this new version?
If Data on TableCreator
was part of the interface i could remove it during config stage instead i'm using
db.CreateTableFrom<T>(cfg => {
List<ColumnDefinition> list = cfg.AsDynamic().Data.Columns;
ColumnDefinition ignore = cfg.AsDynamic().Data.Column("Items");
list.Remove(ignore);
});
if you can suggest an alternative method id be grateful too
There's no support for that, because the the given class is considered to represent the whole table. I'm thinking about adding an overload to CreateTableFrom to use an anonymous object. The thing with 'Ignore' is a bit psychological. If I include that, it will give the impression you're configuring mappings between a class and a table, which is wrong. That ignore would stay only for the table creation. SqlFu views objects only as a data source or destination, it doesn't maintain nor respect any mappings. Basically, I'm trying to avoid the ORM image and behaviour and enforce the fact that SqlFu is just a data mapper on steroids.
firstly i must say i'm really enjoying the project, very cool, i am very grateful and much thanks.
I do agree wholeheartedly that this ignore should be for the create table ddl only and i do think the direction you've taken is a good one.
I'm using sqlfu to project my aggregate types into the database automagically and i want to support IEnumerable properties on my types, i've created a upsert script generator of sorts to inspect the type and assist with applying the data into sql which does also populate the fk relationship between the primary and children tables created but the snag i'm hitting is the failure to ignore for the IEnumerable member in question as sqlfu blows up on CreateTableFrom<T>
otherwise, should i just wrap the above code into an extension method and call it a day then? i only bring this up as v2 had the ignore attribute and there seems to be no similar functionality in v3, be it via config or whatever as other attributes functionality did successfully map across to the new version in some fashion or another, as other people may be relying on this functionality perhaps it should be included for that sake?
im going to close this, i got this version via update-package and i didn't read the latest read me, took a few hours but after a small rewrite im on v3 no issues, just btw i dont consider sqlfu an orm but it was useful to be able to attribute members as well to influence the types serialization,