Note that there are some explanatory texts on larger screens.

plurals
  1. PODataSet ToList method returns empty List, even though it has elements
    primarykey
    data
    text
    <p>Sorry if somebody has already asked this question. I've been looking around but couldn't find anything related.</p> <p>So, I am using Entity Framework and I am trying to load the list of "Idiomas" from the dataset using the ToList method through the following code:</p> <pre><code>//List&lt;Idioma&gt; ans = new List&lt;Idioma&gt;(contexto.Idiomas); return contexto.Idiomas.ToList(); </code></pre> <p>However, the method is returning an empty list, even though I can see through the debugger that the DataSet has elements. </p> <p><strong>EDIT</strong></p> <p>I have not put any extra code because there is not any extra code besides those two lines. I just create a Entity Framework model-first, generated the database, and updated the model from the database to make sure everything was ok. </p> <p>Contexto is a instance from the class LivroContexto, which implements DbContext (auto generated by vs2012, see below).</p> <p>LivroContainer:</p> <pre><code>public partial class LivroContainer : DbContext { public LivroContainer() : base("name=LivroContainer") { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { } public DbSet&lt;Idioma&gt; Idiomas { get; set; } } </code></pre> <p>Idiomas:</p> <pre><code>public partial class Idioma { public Idioma() { this.Traducaos = new HashSet&lt;Traducao&gt;(); } public int IdIdioma { get; set; } public string Lingua { get; set; } public virtual ICollection&lt;Traducao&gt; Traducaos { get; set; } } </code></pre> <p>Thank you</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.
    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