No Cascade() method?

Aug 24, 2011 at 10:58 AM
Edited Aug 24, 2011 at 11:34 AM

Hello,

I've got a problem here with one of my projects. In another project that I use Obtics in, there is a Cascade() method available for a call like this:

public IEnumerable<Blah> Blahs
{

get {

return ExpressionObserver.Execute(from p in _blahs select p).Cascade();

return ExpressionObserver.Execute(this, q => from p in _blahs select p).Cascade();

}

}

But in one project this method appears to be missing. In both projects there's only one reference to obtics.dll (well, aside from all the other .NET 4.0 references that are included by default). Both projects are WPF applications. The main difference is the target framework. The project for which Cascade() is available targets the .NET 4.0 framework client profile and the other one with no Cascade() method targets the bigger .NET 4.0 framework profile (don't know how it's actually called). Can this be the cause of the missing Cascade() method? I don't think so. I'd have understood it, if it had been vice versa (missing in client profile). But it's not.

The referenced DLLs are the same in both projects.

What might have gone wrong here? What prerequisites are there to have the Cascade() method available?

Thanks!

Hendrik

 

// edit: aahh... damn! (sorry) I've just found the major difference that probably causes the missing Cascade() method: the collection I linq to is not of type ObservableCollection<...>. It's an ObjectSet<...> from the System.Data.SQLite assembly. Can anybody confirm or refute that I cannot use Obtics with collections other than ObservableCollection<...>?

Coordinator
Aug 24, 2011 at 11:42 PM

Hi Hendrik,

Out of the box Obtics understands collections that implement INotifyCollectionChanged (like ObservableCollection<>) and BindingList. If a collection is observable through any other mechanisme obtics can be instructed how to understand it via a CollectionAdapter that you will need to create and register with Obtics.

Another issue could be that the Select method for ObjectSet<> is not the Enumerable.Select() extension method. Obtics then does not know how to translate that method. Again you can instruct Obtics how to translate any specific method. Check out the CustomMapping, ObticsToXml and ObticsToDataSet projects on how to do this.

The ObticsToDataSet project can also be used as an example on how to provide a CollectionAdapter.

Regs,

Thomas.