Git Product home page Git Product logo

igorbuchelnikov / observablecomputations Goto Github PK

View Code? Open in Web Editor NEW
108.0 4.0 8.0 40.47 MB

Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces.

License: MIT License

C# 100.00%
observablecollection linq functional-programming declarative declarative-programming observable continuous bind inotifypropertychanged inotifycollectionchanged

observablecomputations's People

Contributors

artemious7 avatar bazile avatar factormystic avatar igorbuchelnikov avatar vslee 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

observablecomputations's Issues

Add support for ReadOnlyObservableCollection

The extension methods doesn't have an overload with ReadOnlyObservableCollection. As ReadOnlyObservableCollection does not inherit from ObservableCollection we have to specify type parameters (or create our own extension methods for ReadOnlyObservableCollection).

How exactly do you build this?

I'm trying to use this into Unity. The .dll from nuget threw errors, so I was going to try and build it myself. However, building has many errors including not being to find ISourceIndexerPropertyTracer, ICanProcessSourceItemKeyChange, ICanProcessSourceItemValueChange... Where are these supposed to be located at?

Consider using WeakEventManagers instead of explicit unsubscribe API

Have you considered using WeakEventManagers to make the references of events weak, instead of using an explicit unsubscribe API? (See microsoft docs PropertyChangedEventManager, CollectionChangedEventManager and Weak Event Patterns) I do not know, but I would expect that Microsoft came up with something that has no (or few) garbage collection issues.

Introducing an unsubscribe API would require all classes using this library implementing IDisposable (or something similar), right?

I hope this is an option for you, because I really like this library and not having to unsubscribe makes it so much nicer to use.

Breaking change in version 2.0.0

In the previous version, there was a possibility of memory leaks due to weak subscription to NotifyPropertyChanged and NotifyCollectionChanged events. In the new version, I removed the weak subscription and added an API to manage the strong subscription to events. See Two computation states: active and inactive section for details. For other changes, see the Release Notes section at NuGet.

Joining System.ArgumentException: 'Property 'System.String Type' is not defined for type 'System.String' Arg_ParamName_Name'

` public class Order : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

	public int Num {get; set;}

	private decimal _price;
	public decimal Price
	{
		get => _price;
		set
		{
			_price = value;
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Price)));
		}
	}

	public Order(int num, decimal price)
	{
		Num = num;
		_price = price;
	}


	public Order(int num, decimal price, string type)
	{
		Num = num;
		_price = price;
		_type = type;
	}

	private string _type;
	public string Type
	{
		get => _type;
		set
		{
			_type = value;
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Type)));
		}
	}
}

		ObservableCollection<Order> orders = 
			new ObservableCollection<Order>(new []
			{
				new Order(1, 15, "A"),
				new Order(2, 15, "A"),
				new Order(3, 25, "B"),
				new Order(4, 27, "C"),
				new Order(5, 30, "A"),
				new Order(6, 75, "C"),
				new Order(7, 80, "A"),
			});

		ObservableCollection<string> selectedOrderTypes = new ObservableCollection<string>(){"A", "B"};

		ObservableCollection<Order> filteredOrders = orders
			.Joining(selectedOrderTypes, (o, ot) => o.Type.Equals(ot))
			.Selecting(oot => oot.OuterItem);

`

Please add a change log or release notes document

Hi, could you consider adding a changelog file to this repo? For example it'd be nice to know what changed between v1.3.0 and v1.4.0, but this doesn't appear to be documented anywhere, and there's no release notes, and the commit history looks like this:

image

Thanks!

EventUnsubscriber "wasting" a thread?

While performance profiling my app, I noticed that ObservableComputations starts a thread called "ObservableComputations events unsubscriber #0" and that thread sits there waiting on a ManualResetEventSlim.
Is this wasteful? Nothing else in my app uses a whole separate thread like this.
Could the same thing be achieved with a TaskCompletionSource or AsyncManualResetEvent ?

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.