Hi,
I am going to need to be able to have something like the concept of 'parameters' in PersistentAlias expressions. the scenario I have is this:
This is a legacy database - many 'companies' share the same tables, but there is an identifier column 'CompanyID' - string type on the table that says which 'company' the data belongs to. When the session is created, we know which 'company' we are working on, and so could for instance provide this data as a Dictionary to the session/unit of work in question. We need to be able to only return the result for the correct company.
For instance:
[PersistentAlias("[<DepartmentsXpo>][CompanyID = ?CompanyDSDepartmentsXpo && DepartmentID = ^.DepartmentID].Single()")]
public DepartmentsXpo DepartmentIDXpo
{
get { return GetValue<DepartmentsXpo>(null,"DepartmentIDXpo"); }
}
Where ?CompanyDSDepartmentsXpo is a value in the Dictionary that we know for the session. Each table in the session would have a different parameter that needed to be checked against to get the correct record for that company, as some companies share the tables!
Now, I can't see how this can be done at present so I wondered if this could be performed as an enhancement (seems simple enough, have a 'parameters' dictionary object for session, we populate that when creating the session, and then the PersistentAlias mechanism looks for a key in the dictionary matching the parameter and replaces the parameter with the value).
Alternatively I was wondering if it could be performed with current functionality through custom functions, and if so if you could point me in the right direction with an example for what I am looking to achieve?