Posts:
1
From:
mexico
Registered:
9/8/09
|
|
|
|
How important is the order of properties in the source file?
Posted:
Sep 8, 2009 7:19 PM
|
|
I have a stored procedure that returns two columns. The first is Timestamp (nullable) and the second is Integer (nullable).
I have a method in my DataContext to execute this function, as follows:
[Function(Name = "SpName")] public ISingleResult<MyClass2> My2AuthorizedTransactionsBOGrid( [Parameter(Name = "IdCardProgram", DbType = "Int")] int idCardProgram, [Parameter(Name = "IdUser", DbType = "Int")] int idUser) { IExecuteResult result = this.ExecuteMethodCall( this, ((MethodInfo) (MethodInfo.GetCurrentMethod())), idCardProgram, idUser);
return ((ISingleResult<MyClass2>) (result.ReturnValue)); }
I have a class that I use to populate the results, as follows:
public class MyClass2 { [Column(DbType = "Int", Name = "Flag")] public bool? IsRelated { get; set; }
[Column(DbType = "rowversion", Name = "IdTimer")] public Binary RowId { get; set; } }
If I placed the Rowid property under the IsRelated property, this creates an exception InvalidCastException, Cannot cast from 'System.DBNull' type to 'System.Byte[]' type.
If I placed the Rowid property below the IsRelated property, everything works fine.
How important is the order in which the properties are placed in the source file? The fact that I had never happened before.
|
|
|
Legend
|
|
Gold: 300
+
pts
|
|
Silver: 100
- 299
pts
|
|
Bronze: 25
- 99
pts
|
|
Manning Author
|
|
Manning Staff
|
|