Hi all,
I need to create a criteria class for search function using CSLA. From the view of CSLA, criteria is an object that store all information related to all value we want to search. This class can be nested in business object or can be derived from CriteriaBase.
From UI code, we must call method like:
Ex: StateList states = StateList.GetState(stateCode, countyCode,...);
But i find this way isn't convinent so i wrap all criterias in one class like below:
[Serializable()]
public class StateCriteria : Csla.ReadOnlyBase<StateCriteria >
{
public string StateCode = "";
public string CountyName = "";
//.... and so on
}
and my code is simpler:
Ex: StateList states = StateList.GetState(stateCriteria); // where criteria hold all value about which state we want to seach.
My approach is still working. But i wonder one thing, CSLA book point that criteria must be nested or inherit from CriteriaBase, because reflection mechaism use this information to create an instance of this object server. Why my approach is still working?
Regards.
Hi all,
I see CSLA uses 2 ways to create a instance on server. When you
call as Data_Portal.Create<T> or Fetch<T> CSLA will use T to find
class. In other case, it uses Criteria.
Hi Rocky, I think you should use only a way.
From: hanami279
[mailto:cslanet@lhotka.net]
Sent: Wednesday, September 12, 2007 10:32
To: phucphlq@dsp.com.vn
Subject: [CSLA .NET] Criteria isn't nested class or derived form
CriteriaBase.
Hi all,
I need to create a criteria class for search function using CSLA. >From the
view of CSLA, criteria is an object that store all information related to all
value we want to search. This class can be nested in business object or can be
derived from CriteriaBase.
From UI code, we must call method like:
Ex: StateList states = StateList.GetState(stateCode, countyCode,...);
But i find this way isn't convinent so i wrap all criterias in one class
like below:
[Serializable()]
public class StateCriteria : Csla.ReadOnlyBase<StateCriteria >
{
public string StateCode = "";
public string CountyName = "";
//.... and so on
}
and my code is simpler:
Ex: StateList states = StateList.GetState(stateCriteria); // where criteria
hold all value about which state we want to seach.
My approach is still working. But i wonder one thing, CSLA book point that
criteria must be nested or inherit from CriteriaBase, because reflection
mechaism use this information to create an instance of this object server. Why
my approach is still working?
Regards.
Copyright (c) Marimer LLC