.netoracle-databaselinq-to-sqldatacontextirepository

What's the Oracle equivalent of System.Data.Linq.DataContext?


I am implementing the IRepository interface against an Oracle database.

public interface IDinnerRepository {

    IQueryable<Dinner> FindAllDinners();
    IQueryable<Dinner> FindByLocation(float latitude, float longitude);
    IQueryable<Dinner> FindUpcomingDinners();
    Dinner             GetDinner(int id);

    void Add(Dinner dinner);
    void Delete(Dinner dinner);

    void Save();
}

How should I implement the Save method? If I was working with Linq2Sql I would create a database context and then call SubmitChanges on the database context. How can I implement the same functionality with an Oracle back end?

    /// <summary>
    /// Database context
    /// </summary>
    private DBDataContext db = new DBDataContext();

    public void Save()
    {
        this.db.SubmitChanges();
    }

Thanks!


Solution

  • I found a good solution that doesn't require me to spend money on a 3rd party tool. I am using NHibernate for my data access. The equivalent for the LinqToSql DataContext object is the NHibernate Session object. This allows me to perform CRUD operations transactionally with Oracle. Thanks!