0

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!

skaffman
  • 398,947
  • 96
  • 818
  • 769
Tarzan
  • 4,270
  • 8
  • 50
  • 70
  • FYI, I am using the Oracle Data Provider for .NET (ODP.net). http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html – Tarzan Sep 27 '10 at 18:45

2 Answers2

0

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.

Community
  • 1
  • 1
Ronald Wildenberg
  • 31,634
  • 14
  • 90
  • 133
  • 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 Oct 08 '10 at 20:57
0

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
  • 4,270
  • 8
  • 50
  • 70