Coder Social home page Coder Social logo

nclone's People

Contributors

davisnw avatar mijay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nclone's Issues

Deep cloning of Dictionarys

I have a use case where I need to clone something that has a field like:
Dictionary<string, <Dictionary<string, string>>

That crazyness is basically a way to get a known 2-level json object to deserialize.

I noticed the inner dictionary was only a shallow copy. If this is not meant to be supported than this isn't an issue, but I thought I'd put this here in case anyone else runs into it.

CircularReference management

This library is exactly what many people working with EF are looking for, unfortunately there's a missing feature that makes it unusable, the capability to clone graph of objects with circular references.

EF Graphs are by default CircularReference Graphs because into the Parent table there is a Collection of Cildren and into the Child table there is the Reference of the Parent.

I tried to fork and to work on your code to add this feature but I'm not enough skilled to do with an acceptable level of quality so I'm asking you if you could work on it to add this functionality.
I'm also available to pay you something for your effort.

Thanks again!
mM

Concurrency Bug

NClone appears to have a concurrency bug.

I recently modified our test suite to run more tests in parallel, and since then I've been getting intermittent failures when cloning. This is using version 1.1.1 from Nuget.

So for example, i I have:

  private Currency _depositAmount = NClone.Clone.ObjectGraph(Currency.Empty);

Then I will sometimes see the exception:

Result Message:

Test method threw exception: 
System.NullReferenceException: Object reference not set to an instance of an object.
Result StackTrace:	
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at NClone.ReplicationStrategies.ReplicationStrategyFactory.StrategyForType(Type type)
   at NClone.ObjectReplication.ReplicationContext.Replicate(Object source)
   at NClone.ObjectReplication.ObjectReplicator.Replicate[T](T source)
   at DomainModel.Entities.Deposit.ctor()

From the stacktrace, I suspect this bug is occurring because the replication strategy is caching per type, but using the non-threadsafe System.Collections.Generic.Dictionary. I suspect replacing with a thread-safe collection would resolve the issue.

Deep clone of structures

The Clone class documentation states that it does not deep clone structures. If that's the case it's a problem because a struct can contain references to mutable objects. When someone updates those objects, your original graph will also change.

Trying to compile NClone from Github

When trying to compile NClone in VS 2013, pulled from Github, I keep getting:

Warning 1 The referenced project '..\mijay.Utils\mijay.Utils.csproj' does not exist. NClone.Tests
Warning 2 The referenced project '..\mijay.Utils\mijay.Utils.csproj' does not exist. NClone.Benchmarks
Warning 3 The referenced project '..\mijay.Utils\mijay.Utils.csproj' does not exist. NClone
Warning 4 The referenced project '..\mijay.Utils\mijay.Utils.csproj' does not exist. NClone
Warning 5 The referenced component 'mijay.Utils' could not be found. NClone

How can I get around this? What is contained in "mijay.Utils" that is needed inside the NClone project(s) ? Couldn't that be included directly into NClone??

Porting to .NET Core

We'd like to use it within ASP.NET Core project.
Is it ever portable to .NET Core?

Default ctor is not invoked during replication

I understand it's by design but I don't get the point why. We have a case when a default constructor must be called, otherwise we end up with a replicated object in an invalid state.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.