I got help earlier with this question:
Ninject: Error Activating Strings
@nemensv solved that one but I immediatley got a new exception regarding IntPtr. (see activation path below).
Been looking through the ctor
here
Only place IntPtr shows up is in this line:
Result r = Platform.SQLiteApi.Open(databasePathAsBytes, out handle, (int)openFlags, IntPtr.Zero);
How can I solve this using ninject?
Complete exception:
Activation path:
6) Injection of dependency IntPtr into parameter method of constructor
5) Injection of dependency BlobSerializerDelegate+SerializeDelegate into parameter serializeDelegate of constructor
4) Injection of dependency IBlobSerializer into parameter serializer of constructor
3) Injection of dependency SQLiteConnection into parameter connection of constructor
2) Injection of dependency ICarRepository into parameter carRepository of constructor
1) Request for MainViewModel
My code in Ninject:
Bind<SQLiteConnection>()
.ToSelf()
.WithConstructorArgument("databasePath", path);
Bind<ISQLitePlatform>().To<SQLitePlatformWinRT>();
Bind<IBlobSerializer>().To<BlobSerializerDelegate>();
Thank you!
EDIT:
This worked for me:
Bind<SQLiteConnection>().ToMethod(ctx => new SQLiteConnection(new SQLitePlatformWP8(), path))
;