Comments (4)
Hey @nkreipke.
I think this sounds like a great idea. I'm not too familiar with all the new .NET API levels, but it sounds like it would be really valuable for non-standard platforms to be able to access RethinkDB.
I would suggest that where possible, it's probably better to use supplemental assemblies rather than conditional compilation. In my experience, conditional compilation is annoying to maintain over time. For example, it'd be preferable to have a .NET 4.5 assembly that provides the System.Configuration capabilities (eg. rethinkdb-net-netconfig?), rather than having it conditionally compiled in one central assembly.
When it's ready, and it has at least a good upgrade path for current users, I'd be happy to review and merge a PR. Let me know how else I can help out; I don't have a lot of spare time, but I'd sure like to do anything I can to encourage a new contributor. :-)
from rethinkdb-net.
I've now moved the System.Configuration part to a separate rethinkdb-net-appconfig project and replaced the ConfigurationAssembler class with a more flexible ConnectionFactoryBuilder. You could now create a connection factory like this:
var factory = new ConnectionFactoryBuilder().FromAppConfiguration().Build("testCluster");
One issue I found with a separate appconfig assembly is that users will have to adjust the section configuration in addition to installing a new package:
<section name="rethinkdb" type="RethinkDb.AppConfig.RethinkDbClientSection, RethinkDb.AppConfig"/>
I've left a deprecation notice in ConfigurationAssembler that notifies users of the changes, however requiring users to change their configuration might cause inconvenience. We might be able to blame Microsoft and their ridiculous System.Configuration architecture for this ;-)
Apart from that, I removed the JSON configuration as we already provide an interface to Microsoft.Extensions.Configuration, which allows loading all sorts of configuration formats. Reading a JSON file would be relatively easy (probably even easier in ASP.NET Core as they're using DI for this):
var config = new ConfigurationBuilder().AddJsonFile("rethinkdb.json").Build();
var factory = new ConnectionFactoryBuilder().FromConfiguration(config).Build("testCluster");
You could also build a connection factory directly with a ClusterElement class.
While porting RethinkDb.Newtonsoft I found some duplicated code where the connection factory is created, but the builder class solves the problem quite elegantly:
var factory = new ConnectionFactoryBuilder()
.FromAppConfiguration()
.UseNewtonsoftJsonSerializer()
.Build("testCluster");
I think all that's left to do for now is updating the examples and documentation. Just wanted to ask if you're OK with these changes :-)
from rethinkdb-net.
The builder approach sounds great to me. I like the implementation of UseNewtonsoftJsonSerializer
as an extension method on the builder; that approach seems really easy to use while still being very flexible to additional extensions in the future.
A little unfortunate that the config file namespace changes, but, I think that's pretty easy to document and not a very onerous change for people to make.
from rethinkdb-net.
FWIW, you can also use this bchavez/C#
driver with RethinkDB which already supports .NET Core and net45
. However, bchavez/C#
driver follows more closely the design of the official drivers & official documentation meaning you'll need to use ReQL in C#.
from rethinkdb-net.
Related Issues (20)
- Reactive example for .NET/C# client HOT 2
- Support for Inheritance in documents / embedded documents HOT 5
- EgJoin HOT 5
- NotSupportedException when retreiving doc with DateTime.MinValue HOT 6
- Add support to the new configuration API (.json) HOT 1
- Support for already serialized documents HOT 5
- Nested Lists HOT 1
- Connection is hanging when server is down
- Atomic update throws InvalidOperationException HOT 3
- TableCreate optional argument 'datacenter' no longer functions. HOT 2
- Filter queries containing sub-queries HOT 2
- Query.OuterJoin overload: missing argument?
- Post-Join Filter expression doesn't work
- Update Item in nested array HOT 1
- ArgumentNullException in mscorlib when attempting to enumerate with First() HOT 2
- Can realtime with winform and rethinkdb ? HOT 2
- Load Data Async/Await HOT 1
- Can we have more CRUB example ? HOT 5
- Example for Query changefeed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rethinkdb-net.