ok - here goes :)

GenericReportDataRepository provides report data - the idea being that
it doesn't need to know where the data comes from or what shape it is.

i have n domains - these domains have report data DTOs which when ran
against the following code will retrieve the data and get populated
from an sp:

<code class="GenericReportDataRepository<T>">

 public IList<T> GetReportData<T>( Hashtable parameters, string
spname, string appname)
 {
           string sql = string.Empty;

            ISQLQuery sessSql = null;

            sql = @"exec spname] ";

            sql += GetSPParams(params);

            sessSql =
sessionManager.OpenSession(sessionName).CreateSQLQuery(sql);

            sessSql = SetSPParams(params);

            sessSql = AddScalarValues(sessSql, typeof(T));

            return sessSql.SetResultTransformer(new
AliasToBeanResultTransformer(typeof(T))).List<T>();

}
</code>

because GenericReportDataRepository only gets called with things like
an assembly name as string, classname as string, the list of params
and their values, i need to create all this on the fly.

sessionName ties to a configured NHibernate Facility session.

i think i may be asking for the moon on a stick with cherries and ice
cream - but this must be possible. i really hope so.

w://

2009/10/31 Krzysztof Koźmic <[email protected]>:
>
> What do you want to do?
>
> Give me actual scenario,
>
> Wayne Douglas wrote:
>> Hi
>>
>> if i have a component registered with :
>>
>> <code>
>>     <component id="GenericReportDataRepository"
>> type="Ideal.Reporting.Domain.GenericReportDataRepository`1,
>> Ideal.Reporting.Domain"/>
>> </code>
>>
>> is there anyway i can retrieve that by using something similar to:
>>
>> <code>
>>
>>  var ass = Assembly.Load(assemblyname);
>>
>>  var type = ass.GetType(typename);
>>
>>  Type openType = typeof(GenericReportDataRepository<>);
>>
>>  Type actualType = openType.MakeGenericType(new Type[] { type });
>>
>>  object obj = Activator.CreateInstance(actualType);
>>
>>  var genrepo = Container.Resolve<GenericReportDataRepository<obj>>();
>>
>> </code>
>>
>> I know the code sucks in terms of names and stuff - i'm just typing it
>> in to gmail - just trying to figure out how to do this.
>>
>> struggling a bit :)
>>
>>
>
>
> >
>



-- 
Cheers,

w://

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to