0

How to use ObjectContext and ObjectQuery<T> with my own classes and objects?

I.e. I don't want to use them with Entity Framework.

How can I do this?

Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
user366312
  • 16,949
  • 65
  • 235
  • 452

1 Answers1

1

ObjectContext and ObjectQuery are the Entity Framework. You could implement your own Custom Linq Provider. A very good example can be found at "THE WAYWARD WEBLOG" http://blogs.msdn.com/mattwar/pages/linq-links.aspx. This Blog helped me implementing my own custom Provider.

public interface IQueryable : IEnumerable {       
    Type ElementType { get; }
    Expression Expression { get; }
    IQueryProvider Provider { get; }
}

public interface IQueryProvider {
    IQueryable CreateQuery(Expression expression);
    IQueryable<TElement> CreateQuery<TElement>(Expression expression);
    object Execute(Expression expression);
    TResult Execute<TResult>(Expression expression);
}
Arthur
  • 7,939
  • 3
  • 29
  • 46