c# - using struct as TEntity in DbSet<TEntity> -


i need create database using entity framework code-first methodology store data sent tcp client. told implement data struct using other structs properties. of these structs including data used extensively in other parts of server code.

the problem next have create database context class dbset requires tentity reference type class can't reuse data struct.

do have no choice rewrite data struct , other related structs classes kinda annoying , feel redundant or there other more elegant way go around this? possible somehow cast or 'convert' structs classes?

my data struct:

    public struct data     {     public datetime timestamp { get; set; }     public struct1 somestruct { get; set; }     public struct2 otherstruct { get; set; }     ...     } 

error code cs0452 in context class:

    public class datacontext : dbcontext     {     // data struct has class. do???     public virtual dbset<data> datas { get; set; }      ...     } 


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -