c# - Dynamic Property Binding in EF? -
apparently, same columns value-type differs across environments same database entity (table) & refuse update common type - don't ask why!
i using entity framework (version 6.1.3) alongside unit of work data-access. and, can guess, getting errors because dev & qa database definitions not match same column.
the news:
not save these particular tables - query particular tables.
sample model:
there more columns this.
public partial class transactions { [key] public int transactionid { get; set; } public float amount { get; set; } //<-- type differs between database environments }
my question:
- is there way dynamically bind value column in entity framework?
- or, can treat dynamic under-the-hood...and transform expected type constant model?
optimally - , clear:
define property concretely, , have entity framework "convert" unknown type & concrete type - under-the-hood.
any appreciated.
if types of columns compatible (i.e. numbers) can have common type on class disable model checking (and migration). solution work on dbmss , not on others (depends on provider).
you can write view cast , map in model (and not table).
you can write direct query ef (official docs https://msdn.microsoft.com/en-us/data/jj592907.aspx similar dapper solution same advantages , defects, in case lazy load won't work).
Comments
Post a Comment