I have a datagridView on windows forms, I fetch the EntityCollection, the columns have been made automatically in the datagrid when selecting the DataSource.
I added in designer an EntityCollection to a Binding Source then the BindingSource to the grid.
If I delete the 3 columns from the grid that are double in the database I get no errors.
public void LoadData(int numLot)
{
DataAccessAdapter adapter = new DataAccessAdapter();
IRelationPredicateBucket bucket = new RelationPredicateBucket();
_loteAModificarCollection.Clear();
bucket.PredicateExpression.Add(MpsCompositionFields.Lote == numLot);
adapter.FetchEntityCollection(_loteAModificarCollection, bucket);
adapter.CloseConnection();
}
]
I also get the error when fetching an entity, when loading data from those fields. I have the error on the GET at the generated code in this part of any of the 3 DOUBLE columns:
/// <summary> The TotalAgregado property of the Entity MpsCompositionLote<br/><br/>
/// </summary>
/// <remarks>Mapped on table field: "MPS_COMPOSITION_LOTE"."TOTAL_AGREGADO"<br/>
/// Table field type characteristics (type, precision, scale, length): Double, 10, 5, 8<br/>
/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
public virtual Nullable<System.Double> TotalAgregado
{
get { return (Nullable<System.Double>)GetValue((int)MpsCompositionLoteFieldIndex.TotalAgregado, false); }
set { SetValue((int)MpsCompositionLoteFieldIndex.TotalAgregado, value); }
}
I debugged using this too:
DataAccessAdapter adapter = new DataAccessAdapter();
MpsComposicionLoteEntity ent = new MpsComposicionLoteEntity(1);
adapter.FetchEntity(ent);
MessageBox.Show(ent.TotalAgregado.ToString());
after fetching the entity and wathcing the values, on the columns that are double I get this:
'ent.Consumo' threw an exception of type 'System.InvalidCastException'