I have the following function setup in my domain base:
public void SetProcessFlag<T>(bool flag)
{
string tableName = typeof(T).ToString().Replace("MyBase.Core.Domain.", "");
string sql = string.Concat("update ", tableName, " set ImportProcessed = '" , (flag?"1":"0"), "';");
Framework.FluentSessionManager.GetSession()
.CreateSQLQuery(sql)
.ExecuteUpdate();
}
I have a mapping with the schema of “Catalog” and the table of “Parts”. It contains a mapped column “ImportProcessed” as Bool.
Now when I want to set the column “ImportProcesses” to true I call is like the this:
new Parts().SetProcessFlag<Parts>(true);
This works just fine. I don’t like having to assume that the folder the declaration of the record set has the same name of the schema.
Is it possible to do the same thing with?:
Framework.FluentSessionManager.GetSession()
.CreateCriteria(typeof(T))
....
Or even a more elegant method?
Thanks in advance.
use HQL, it is made for this