views:

58

answers:

2

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!

A: 

If you want to use the LinqToSql equivalent for Oracle, there is a LinqToOracle project on CodePlex. It provides an OracleDataContext and everything else you need. However, the most recent checkin is from July 20, 2010 so there's not a lot going on there.

You could also start using LinqToEntities which was designed to be platform-independent. However, I can only find a commercial provider. Here's another SO question on using Oracle with the ADO.NET Entity Framework.

Ronald Wildenberg
Thank you for the ideas. The LinqToOracle project is out of date. The last update was made in 2008. I do not want to purchase a commercial provider.
Tarzan
A: 

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!

Tarzan