For testing purposes I need to create an instance of the EntityDescriptor
class. This cannot be done directly, cause the constructor is not public.
That's why I try use reflection to create the instance.
EdmModel model = new EdmModel();
var constructors = typeof(EntityDescriptor).GetConstructors(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var entityDescripto = constructors[0].Invoke(new object[] { model }) as EntityDescriptor;
I know, that the single constructor of the class takes one argument of type EdmModel
. But when I call the above code I the following exception:
System.ArgumentException : Das Objekt mit dem Typ "Microsoft.Data.Edm.Library.EdmModel" kann nicht in den Typ "System.Data.Services.Client.ClientEdmModel" konvertiert werden.
But I cannot find anywhere the class ClientEdmModel
. Does anybody has an idea?
Aucun commentaire:
Enregistrer un commentaire