sapiens/SqlFu

Table config without attributes

Closed this issue · 2 comments

Dear Developer,
I have used SqlFu in some personal projects, and I'm loving it!
Howewer I'm not a fan of the Table attrib, so I made TableInfo public and added some methods like:

public TableInfo SetPrimaryKey(string fieldName, bool autogenerated)
    {
        PrimaryKey = fieldName;
        AutoGenerated = autogenerated;
        return this;
    }

With this I'm able to do:

TableInfo.ForType(typeof(B_DATUMOK)).SetPrimaryKey("DTAZON", true);

in my db service init without touching old tables and old pocos.

I'm going to release v3 Beta which has this feature, this week . v2 wil become legacy pretty soon.

Thanks!

My other small hack to avoiding IgnoreAttribute is

    var ig = p.GetSingleAttribute<IgnoreAttribute>(true);
    if (ig == null && p.CanWrite)

in public TableInfo(Type t)