c# - LINQ query a list inside a record -


edit turns out ef wont map list strings table. fix i've created simple table id, string field , foreign key example table, in example table i've updated list<> attribute point table. ...i think had brain fart. sorry all.

i've tried other questions i'm still getting same error.

i have table following:

 public class example {    public example()    {        examplelist = new list<string>();             }     public int id { get; set; }    public string name { get; set; }    public string description { get; set; }          public list<string> examplelist{ get; set; } } 

now when go query database, want return entries contain "imastring" in examplelist i'm using:

    var test = db.examples.where(c => c.examplelist.count(z => z.contains("imastring")) == 0).tolist(); 

however, query brings following error:

the specified type member 'examplelist' not supported in linq entities. initializers, entity members, , entity navigation properties supported.

i can't figure out whats wrong, missing guys?

for clarity

i'm trying bring "example" record whos "examplelist<>" contains string "imastring"

you cannot store in database list of string type (or primitives). need create example exampletable class id , string value. or keep whole list in 1 property (for example strings separated ';') , parse given string split. or serialize list json , save string property.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -