You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class called ModelSetWrapper which wraps model sets from an EfCore DbContext (Jet, specifically) and returns a dictionary containing the model set information. Here's what the class looks like:
I'm able to load this assembly and types from it using pythonnet without any issues. However when I attempt the following in my python code:
wrapper = ModelSetWrapper[Jaugeage]()
I get an error:
---------------------------------------------------------------------------
InvalidOperationException Traceback (most recent call last)
Cell In[2], line 1
----> 1 wrapper = ModelSetWrapper[Jaugeage]()
InvalidOperationException: The property can only be set once.
at EntityFrameworkCore.Jet.Data.JetConnection.set_DataAccessProviderFactory(DbProviderFactory value)
at EntityFrameworkCore.Jet.Data.JetConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.<>c.<MoveNext>b__21_0(DbContext _, Enumerator enumerator)
at EntityFrameworkCore.Jet.Storage.Internal.JetExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at LibFacade.Utils.ModelSetWrapper`1..ctor() in [C:\Users\admin\Desktop\TEMP\projects\317\notebooks\Lib\LibFacade\ModelSetWrapper.cs](file:///C:/Users/admin/Desktop/TEMP/projects/317/notebooks/Lib/LibFacade/ModelSetWrapper.cs):line 12
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeConstructorWithoutAlloc(Object obj, Boolean wrapInTargetInvocationException)
I have searched far an wide for a solution but don't really know how to start tackling this. Any pointers would be very welcome.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a class called
ModelSetWrapper
which wraps model sets from an EfCore DbContext (Jet, specifically) and returns a dictionary containing the model set information. Here's what the class looks like:This seems to work fine from the .NET side. From a console app, the following runs without any errors:
I'm able to load this assembly and types from it using pythonnet without any issues. However when I attempt the following in my python code:
wrapper = ModelSetWrapper[Jaugeage]()
I get an error:
I have searched far an wide for a solution but don't really know how to start tackling this. Any pointers would be very welcome.
Beta Was this translation helpful? Give feedback.
All reactions