Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase not showing up in Visual Studio
    primarykey
    data
    text
    <p>I'm developing an application using C# in Visual Studio. This is my first C# application which will use a local database and I am therefore unsure exactly how this is done. I have been following <a href="http://www.codeguru.com/csharp/article.php/c19233/Introduction-to-Entity-Framework-Code-First.htm" rel="nofollow">this article</a> from codeguru.</p> <p>I have declared my entities, all of which are currently just inheriting from this:</p> <pre><code>public class Reference { /// &lt;summary&gt; /// ID of the reference. /// &lt;/summary&gt; public int Id { get; set; } /// &lt;summary&gt; /// Reference to the element in theTVDB. /// &lt;/summary&gt; public int TheTVDBId { get; set; } /// &lt;summary&gt; /// Whether or not the reference has been marked as watched. /// &lt;/summary&gt; public bool IsWatched { get; set; } } </code></pre> <p>I have also declared my DbContext as the following:</p> <pre><code>public class Library : DbContext { /// &lt;summary&gt; /// Constructor using the base constructor. /// This constructor names the database "Library". /// &lt;/summary&gt; public Library() : base("Library") { } /// &lt;summary&gt; /// Set of TVSeriesReferences stored in the database. /// &lt;/summary&gt; public DbSet&lt;TVSeriesReference&gt; TVSeriesReferences { get; set; } /// &lt;summary&gt; /// Set of SeasonReferences stored in the database. /// &lt;/summary&gt; public DbSet&lt;SeasonReference&gt; SeasonReferences { get; set; } /// &lt;summary&gt; /// Set of EpisodeReferences stored in the database. /// &lt;/summary&gt; public DbSet&lt;EpisodeReference&gt; EpisodeReferences { get; set; } } </code></pre> <p>I am trying to store entities in the database doing the following:</p> <pre><code>Library db = new Library(); TVSeriesReference reference1 = new TVSeriesReference(); reference1.TheTVDBId = 1234; reference1.IsWatched = true; db.TVSeriesReferences.Add(reference1); TVSeriesReference reference2 = new TVSeriesReference(); reference2.TheTVDBId = 8000; db.TVSeriesReferences.Add(reference2); int i = db.SaveChanges(); </code></pre> <p>All of this seems to work. At least, I get no errors and <code>i</code> is 2 on every run.</p> <p>The problem is that the database (which is named "Library") does not show up anywhere. Actually, I don't even have that "Object Explorer" view and I can't seem to find it. As the database doesn't show up, I am unsure whether or not this is working and if my data is actually stored.</p> <p>Does anyone know what I am doing wrong or if I am missing something?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload