Tables not shown in VS SQL Server Object Explorer

242 Views Asked by At

I am trying to develop my first web application. I am using ASP.NET MVC + EF code first.

I am using dbContext and I am able to read and save/add data, but in SQL Server Object Explorer Tables are not shown (except System Tables).

I am using such connection string:

      <connectionStrings>
    <add name="TargowiskoContext" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Targowisko;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"/>
  </connectionStrings>


        public TargowiskoContext() : base("TargowiskoContext")
    {

    }


    public DbSet<Advertisement> Advertisements { get; set; }
    public DbSet<Category> Categories { get; set; }
    public DbSet<Conversation> Conversations { get; set; }
    public DbSet<Message> Messages { get; set; }
    public DbSet<Transaction> Transactions { get; set; }
    public DbSet<User> Users { get; set; }
}

Sample model class:

    public class Advertisement
{
    public  int AdvertisementID { get; set; } 
    public string AdvertisementTitle { get; set; }
    public string AdvertisementContent { get; set; }
    public string ImageFileName { get; set; }
    public decimal Price { get; set; }
    public bool IsHidden { get; set; }
    public DateTime DateAdded { get; set; }
    public DateTime DateRecentlyModified { get; set; }
    public int PublisherID { get; set; }
    public int CategoryID { get; set; }
    public virtual User Publisher { get; set; }
    public virtual Category Category { get; set; }
}

I have updated SQL tools to newest version. I can add table manually in VS SQL Server Object Explorer and it is then visible in SSOE, and saved. Does anyone has idea what is the problem/how to fix it?

0

There are 0 best solutions below