mbdavid / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file

Home Page:http://www.litedb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.netstandard 1.x support?

yetanotherchris opened this issue · comments

Hi - thanks for making this open source, it's amazing how fast it is and cleanly written code.

Are there any plans to support .netstandard 1.x any time soon? I tried cloning and using the VS tool but there were a few problems with Emit.

I'm not sure if that was the codebase or because I don't have the whole PCL bits installed though.

commented

Could you try the Core Project ? This doesn't use Emit.

I tried it myself many times with .netstandard & (and .NetCore) but got overwhelmed with possiblies of frameworks in .NetCore

This was the core project that I tried

commented

I bet you tried the .Net45 Platform, which has Emit in it, better copy .Net45 Platform Code and replace the EmitHandler with the ExpressionReflectionHandler

I tried recreating the project as a .netcore one, in Visual Studio 2015 Preview 3 as I couldn't get the upgrade tool working with the LiteDb.Core solution.

It compiled but the tooling is so flakey I eventually gave up. I think to move to .netstandard 1.6 you will need to use a new project with links, and remove the Android/iOS/WUP providers and import System.Cryptopgraphy.Algorithms in the project.json.

It definitely needs knowledge of the code base to do, I wouldn't be confident doing it in a PR. However it shouldn't take more than a few hours max.

Hi @yetanotherchris, I tried to do this too, and gave up too. I didnt know deeply this new core world. I will needs study more to try convert. I beleave that, with this new LiteDB.Core solution will not be too complex.

tip: If you are converting, the folder "LiteDB\Platform (https://github.com/mbdavid/LiteDB/tree/master/LiteDB/Platform)" contains all implementations for all platforms. So, in vs project I add/remove according target library. All rest of source are some to all platforms.

I finally managed to get it compiling, after ditching using VS2015 Preview 3 and going back to VS2015 Update 3. I created a brand new .netcore class library, and added PCL as my compilation symbol.

A few things I've noticed:

  • Rijndael doesn't currently have an implementation, or exist as a type. I switched to Aes but it's an abstract class (Aes.Create works however, not sure what it does).
  • type.IsClass - Not in the framework yet as far as I know, so I commented it out.
  • I've no idea how you support 5+ frameworks, it might make sense to have a separate project with linked files.

Anyway this is the project.json if it's any help. I doubt it works! I had to comment out chunks of EmitReflectionHandler

{
  "title": "LiteDB",
  "version": "1.0.0-*",
  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "System.Security.Cryptography.Algorithms": "4.2.0",
    "System.Collections.Specialized": "4.0.1",
    "System.Reflection.Emit.Lightweight": "4.0.1",
    "System.Threading.Thread": "4.0.0",
    "System.Reflection.TypeExtensions": "4.1.0"
  },
  "frameworks": {
    "netstandard1.6": {
      "imports": "netcoreapp1.0"
    }
  },
  "buildOptions": {
    "define": [ "PCL" ]
  }
}

Hi @yetanotherchris

  • Rijndael and EmitReflectionHandler are only for dotnet full (must be excluded from .netcore project). Can you use ExpressionRefection in .netcore? I beleave for first version encryption can be out.
  • Is project.json deprecated? I saw in another projects using xproj as new project file format that are not folder based (it's like csproj). Maybe this it's easy to create it.

Until Microsoft add Rijndael I'll leave this issue closed.

Project.json still exists, but the tooling update due in Q1 2017 is going to make it obselete. The APIs should also be a lot richer then too, so it's probably not worth doing until Microsoft release the V2 of .NET core instead of the current rushed out version.

I know this issue is closed, but: For the last couple of hours I've been working on implementing my own ILitePlatform implementation in an Asp.Net Core app that I'm working on, and I've just got everything in place.

I got the Emit stuff to compile. @yetanotherchris it looks like you were missing "System.Reflection.Emit.ILGeneration": "4.0.1"
Also type.IsClass is now type.GetTypeInfo().IsClass (using "System.Reflection.TypeExtensions": "4.1.0").

As for Rijndael, I just used AES in my IEncryption implementation, it's good enough for my purposes.

Hi @sgrassie, did you do Platform Asp.Net core works? Do you want request a PL? I'm stat working in dev branch to next v3 will be .netstandard 1.4 compatible.

I can pull the stuff I've done out and send a PR through, I will sort it
out in the next couple of days.

On Tue, 13 Sep 2016, 11:53 Mauricio David, notifications@github.com wrote:

Hi @sgrassie https://github.com/sgrassie, did you do Platform Asp.Net
core works? Do you want request a PL? I'm stat working in dev branch to
next v3 will be .netstandard 1.4 compatible.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#219 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAL2XBVr6n0JmUBwU2Fm73kyLMzgoGXwks5qpoCogaJpZM4JUCgb
.

While we wait the @sgrassie pull request I did a rapid implementation based on his comment. If anyone need it you can check it here

Regards.

I've not had time to put together a PR, and at the moment it will probably
be next week before I can. The contents of that gist look pretty similar to
what I have written.

On Fri, 16 Sep 2016, 17:00 Victor, notifications@github.com wrote:

While we wait the sgrassie pull request I did a rapid implementation. If
anyone need it you can check it here
https://gist.github.com/vfabregat/f11c733f574bbb8b799d1c202a16fe09

Regards.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#219 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAL2XEDdbb_6m0mKBoRB5fWUxytHQnR0ks5qqr0FgaJpZM4JUCgb
.