database - Storing object as a column in LINQ -


I have some classes that make themselves of a string, such as:

  CurrencyVector v = new currency vector ("10 WmR / 20 wmz");  

This is actually a class that holds many currency values, but it does not make any difference.

I would have to change the column type in my LINQ table (vs. 2010 designer) from string to that class, CurrencyVector.

If I do this - I get runtime error, when LINQ tries to put the runtime string in the form of a currency vector (when the table is created from the database). Adding IConvertible does not help.

I wrapped these columns in properties, but this is an ugly and slow solution. The search engine did not produce any results.

You can always expand the square and create another property that returns the object. Like this (pseudo-code)

  public partial class MyLinqEntity {public CurrencyVector CurrencyVector {get new CurrencyVector (this.ColumnHoldingCurrencyVector); }}}  

Where is the argument for converting strings into constructs in the currency unit.


Comments