Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-630

Saving to Different Collection

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Windows 7

    Description

      I have the following model:

      public class Account: Entity
      {
      public string Email

      { get; set; }
      public string Name { get; set; }

      public string Designation

      { get; set; }
      public string Telephone { get; set; }

      public string Mobile

      { get; set; }
      public string CompanyId { get; set; }

      }

      public class Store : Entity
      {
      [Required]
      [DataMember]
      public string Name

      { get; set; }
      [Required]
      [DataMember]
      public string Address1 { get; set; }

      [DataMember]
      public string Address2

      { get; set; }
      [Required]
      [DataMember]
      public string City { get; set; }

      [DataMember]
      [DisplayName("State/Province")]
      public string State

      { get; set; }
      [Required]
      [DataMember]
      public int Zip { get; set; }


      [DataMember]
      public string CompanyId

      { get; set; }

      }

      And the following repository:

      public class AccountRepository : MongoRepository<Account> , IAccountRepository {}

      public class StoreRepository : MongoRepository<Store>, IStoreRepository{}

      When i try to add an item to the account with the code below, an instance is also added to the store. What code be the cause of the store addition? I have debug my code to ensure that there are no call to StoreRepository add. Thanks in advance.

      AccountRepository repo = new AccountRepository();
      repo.Add(new Got2FindMe.Infrastracture.Model.Account

      { Id = id, Email = model.Email }

      );

      Attachments

        Activity

          People

            Unassigned Unassigned
            williamtell william tell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: