robertohuertasm / SQLite4Unity3d

SQLite made easy for Unity3d
MIT License
1.29k stars 266 forks source link

Consider the possibility to avoid the use of interfaces #5

Closed cardinalby closed 9 years ago

cardinalby commented 9 years ago

You have added interfaces for SQLiteNet classes: ISQLiteConnection, ITableQuery … Using interfaces is good practice, but in this lib we have some troubles with them and I don’t see why we need to use them. Problems again relates to using interfaces and generic methods with iOS aot-only compilation. Below the code from my project:

nextDbLevel = connection.Table<DbLevel>().
Where( … ).
OrderBy(l => l.Number).
First();

It works on Android but don’t on iOS. To fix I need use explicit cast to hint AOT compiler generate necessary native code:

var nextDbLevels = (TableQuery<DbLevel>) connection.Table<DbLevel>().Where( … );
nextDbLevel = nextDbLevels.OrderBy(l => l.Number).First();

Ok, but if we need cast to TableQuery<> what is advantages of using ITableQuery<>? I try to deleted all interfaces and now I can use lib without casting, it looks better.

robertohuertasm commented 9 years ago

Hi @cardinalby , consider it done. I'm trying to import also the latest version of SQLite-net but I'm having issues with Unity 5 and Windows Phone compatibility. I'll let you know when it's done!

robertohuertasm commented 9 years ago

Done!

cardinalby commented 9 years ago

Removing your own interfaces you have deleted IDisposable interface inheritance from SQLiteConnection. Please check it!

robertohuertasm commented 9 years ago

You're absolutely right! I will fix it all this evening with the new version. The SQLite version will be the latest anyway so I guess it all will get solved.

Thanks!

robertohuertasm commented 9 years ago

Hi @cardinalby, you've got your IDisposable interface back! :D

cardinalby commented 9 years ago

Plugins.zip hasn't been updated after fix

robertohuertasm commented 9 years ago

My bad... I just changed the file yesterday. I didn't have time for more :( I'll let you know when it's done!

Thanks for your cooperation!

robertohuertasm commented 9 years ago

Done!