The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

MSDTC required errorI

Last post 08-13-2008, 4:45 AM by Mike.Griffin. 3 replies.
Sort Posts: Previous Next
  •  08-12-2008, 7:34 PM 10703

    MSDTC required errorI

    The code below works fine against my local sql server.  However, when I execute against the remote sql server I get a TransactionManagerCommunicationException with the message "Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool."  However, I do not see how this is a distributed transaction unless the Save() for each object is on a different connection.  I must be doing something wrong wrt configuration because I can't believe that a transaction involving N different orm classes would require N connections to the same database.  How can I correct this without enabling MSDTC?

     Thanks 

    Code:
    			LoadProviderFactory("BackOffice");
    			User mu = new User();
    			Contact contact = new Contact();
    			using (TransactionScope scope = new TransactionScope())
          {
    				mu.AddNew();
    				mu.AnonymousInd = false;
    				mu.DeletedInd = false;
    				mu.UserId = Guid.NewGuid();
    				contact.AddNew();
    				contact.FirstName = "Delete";
    				contact.LastName = "Me";
    				contact.DoNotCallInd = true;
    				contact.DoNotEmailInd = true;
    				contact.DoNotMailInd = true;
    				contact.DeletedInd = false;
    				contact.LegacyContactId = 123456;
    				contact.Title = "Lackey";
    				contact.Save();
    				mu.ContactId = contact.ContactId;
    				mu.Save();
    				scope.Complete();
    
          }
    
  •  08-12-2008, 9:19 PM 10706 in reply to 10703

    Re: MSDTC required errorI

    Use this:

    Code:
    using (esTransactionScope scope = new esTransactionScope())

    Instead of this:

    Code:
    using (TransactionScope scope = new TransactionScope())

    In your config, make sure you are using this:

    Code:
    providerClass="DataProvider"

    and not this:

    Code:
    providerClass="DataProviderEnterprise"

    David Neal Parsons
    www.entityspaces.net
  •  08-12-2008, 9:54 PM 10708 in reply to 10706

    Re: MSDTC required errorI

    Thanks for the reply.  What is the behavior with regard to the number of database connections when N objects are scoped within the transaction?  When using DataProviderEnterprise it appeared that each Save() was on a separate db connection.  Is this correct and would it also be the case with DataProvider?
  •  08-13-2008, 4:45 AM 10716 in reply to 10708

    Re: MSDTC required errorI

    DataProviderEnterprise uses the Microsoft TransactionScope class which requires the "Distrubuted Transaction Coordinator" (MSDTC) and allows you to have true distributed transactions involving many databases, servers, MSMQ and more. Our esTransactionScope has the same API but uses ADO.NET transactions which are not distributed (and therefore faster). I'm not sure what you mean by Save being on a differenent connection. Your ADO.NET dataprovider will use connection pooling, every time EntitySpaces hits the databases it uses a new connection, this connection may or may not have come from the connection pool.

    Also, there is no need to ever use transactions unless you are save two different unrelated EntitySpaces objects.  


    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML