Add covariance generic to IDataPortal<T> and IChildDataPortal<T> #2915
Replies: 4 comments 3 replies
-
From where do you get |
Beta Was this translation helpful? Give feedback.
-
@rockfordlhotka My point here is just Csla changes a little bit code to help working with reflection easier. The Back to your question. I should use In the meantime, I could use several workarounds. E.g
To be honest, getting a service from a type should not be a problem. |
Beta Was this translation helpful? Give feedback.
-
I don't know if this is such a simple change. If I add This is all new to me. I haven't used |
Beta Was this translation helpful? Give feedback.
-
I did add the non-generic interface types (#2918), so this is now possible and probably addresses your requirement? object CreateBusinessObject(ApplicationContext applicationContext, Type type, params object[] criteria)
{
var dpType = typeof(IDataPortal<>).MakeGenericType(type);
// This cast requires covariance generic
var dp = (IDataPortal)applicationContext.GetRequiredService(dpType);
return dp.Create(criteria);
} |
Beta Was this translation helpful? Give feedback.
-
@rockfordlhotka Can you add covariance generic to
IDataPortal<T>
andIChildDataPortal<T>
. That requires just a little bit change (as the code below) but makes Csla more flexible.E.g in my case, I need to use
IDataPortal<>
through refection as the code below. It only works ifIDataPortal<>
is covariance generic.Beta Was this translation helpful? Give feedback.
All reactions