Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:39:00+00:00 2026-06-10T20:39:00+00:00

I have created Generic Repository and I have two entities that i need to

  • 0

I have created Generic Repository and I have two entities that i need to update in a transaction.
Here is what i m doing..

ProductOrganizationEntity poDataContext= new ProductOrganizationEntity();
IRepository<tblProductInfo> productRepo = new GenericRepository<ProductOrganizationEntity, tblConfirmation>(poDataContext);

Piece of Code which is causing problem is this.

 using (TransactionScope txScope = new TransactionScope())
 {
                    productRepo.Attach(productEntity);
                    productRepo.SaveChanges();
                    new ProductLocation().SaveLocation(productEntity.Locations, productEntity.productCode);
                    txScope.Complete();
 }

productRepo.SaveChanges(); This is where it throws me Error. The error is

The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "Venus" was unable to begin a distributed transaction.

(We do have server named Venus but its not access in anyway in these transactions at all. Secondly as i said this works without transaction block).

This piece of code works fine if taken out from Transaction Block.

ProductLocation.SaveLocation is creating Repository for Location . Here is the code from Save Location.

IRepository<LocationInfo> locRepo= new GenericRepository<ProductOrganizationEntity, LocationInfo>(new ProductOrganizationEntity());

 if (loc.locID <= 0) // This is a new Location to be added.
      locRepo.Add(locEntity);
 else
     locRepo.Attach(siteToAdd);

 locRepo.SaveChanges();

Here is what i have done in my generic repository for thse methods

   public void Attach(TEntity entity)
    {
        if (entity == null)
            throw new ArgumentException("Update : Supplied Entity is Null.");

        _currentDbSet.Add(entity);
        System.Data.Entity.Infrastructure.DbEntityEntry entry = _dataContext.Entry(entity);
        entry.State = System.Data.EntityState.Modified;
    }

and this is what i have in SaveChanges in my generic repo.

 public virtual void SaveChanges()
    {
        if (_dataContext == null)
            throw new Exception("SaveChanges: DataContext is not initialized.");

        _dataContext.SaveChanges();
    }

What is that i am doing wrong here .

I appreciate any pointers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:39:01+00:00Added an answer on June 10, 2026 at 8:39 pm

    It might be possible that your server is linked to another SQL server at the database level.

    Perhaps look at this: http://msdn.microsoft.com/en-us/library/ms188279.aspx

    Must admit I’ve never used linked servers (not yet at least), but seeing “Linked Servers” in the error made me think of this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a generic repository that handles querying my entities. When I call this:
I have created a generic unit of work/repository pattern and it works in most
So basically i have a domain object and a generic repository that can do
I have an application that uses a generic repository pattern for data access. As
A bit new at the Repository Pattern. Trying to build a generic repository that
I have created some JQuery that will expand a div 'popup' on hover and
I have created an android application that calls (using kSOAP library) a SOAP based
I have created a function that shows/hides different messages according to a combination of
I have created two imageViews promatically as shown below: public void createImageViews(Integer count){ ImageView[]
I have some entities created with LINQ-to-SQL. Six of these entities (representing values primarily

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.