简体   繁体   中英

What is the best way to implement generic Repository pattern based on JSON.NET and returning IQueryable<T>?

For example we have simple interface for generic repository:

public interface IRepository<T> where T: class, IAgregateRoot
{
    void Insert(T agregateRoot);

    void Delete(T agregateRoot);

    IQueryable<T> GetAll();

    IQueryable<T> SearchFor(Expression<Func<T, bool>> predicate);

    T GetById(Guid id);
}

Its necessary to implement this using JSON.NET. What is the best way to do this? Should we use some data types from .NET to store collection in memory, eg System.Data.Linq.Table?

I enjoy the setup of this guys repository pattern. Though I feel it is getting a bit heavy now. You could take the parts you like and strip out the rest like I have done. Mainly look at the Repository implementation.

Link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM