0

guys.

Let me explain the problem I have:

public class User
{
   [Key]
   public Guid Id { get; set; }
   public string SomeData { get; set; }
}

public class UserDbContext : DbContext
{
   public DbSet<User> Users { get; set; }
}

and another class that needs to store information about the User.

public class SameStorageClass
{
   [Key]
   public Guid Id { get; set; }

   public string AnotherData { get; set; }

   public User UserInfo { get; set; } //<-- I need here to store user info
}

with another DbContext

public class AnotherDbContext : DbContext
{
   public DbSet<SameStorageClass> Storages { get; set; }
}

But now I can realize the synchronization mechanism only manually. I really want to have this in automatic mode. Is it possible? If "yes" then "how"? Now I use Guid and store User Id field.

Thank you.

Dmitriy
  • 885
  • 16
  • 34

0 Answers0