I have an oracle table that has a column 'ORDINAL' defined as a Number(1). In my code I need to modify the value and save it back to the database. I don't control the database. It is a legacy database being generated by a different entity.
I opened up the Entity Developer for dotConnect modeling tool and added the USER_PASSWORD_HISTORY table. The column ORDINAL gets added as a type of Boolean. If I try to edit the type to 'Int32' (or byte or anything else) I get the error below.
I was thinking about going into the ...Designer.cs file and manually changing bool to int but I have been regenerating the model as I add and modify tables and don't want to have to do that every time I modify the model. Any help?
1 Member Mapping specified is not valid. The type 'Edm.Int32[Nullable=False,DefaultValue=]' of member 'Ordinal' in type 'DMS.Entities.Pearl.User.UserPasswordHistory' is not compatible with 'Devart.Data.Oracle.bool[Nullable=False,DefaultValue=]' of member 'ORDINAL' in type 'DMS.Entities.Pearl.User.Store.USER_PASSWORD_HISTORY'. UserPasswordHistory
Number(1) to Boolean conversion
-
- Posts: 10
- Joined: Mon 01 Mar 2010 20:17
- Contact:
-
- Posts: 10
- Joined: Mon 01 Mar 2010 20:17
- Contact:
If I understand what you are saying it is to change the bolded bool to int in the part of the model shown below. However, if I do that, then I will need to do it EVERYTIME I regenerate the model correct?
///
/// There are no comments for Property Ordinal in the schema.
///
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public bool Ordinal
{
get
{
bool value = this._Ordinal;
OnGetOrdinal(ref value);
return value;
}
set
{
this.OnOrdinalChanging(ref value);
this.ReportPropertyChanging("Ordinal");
this._Ordinal = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("Ordinal");
this.OnOrdinalChanged();
}
}
private bool _Ordinal;
partial void OnGetOrdinal(ref bool value);
partial void OnOrdinalChanging(ref bool value);
partial void OnOrdinalChanged();
///
/// There are no comments for Property Ordinal in the schema.
///
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public bool Ordinal
{
get
{
bool value = this._Ordinal;
OnGetOrdinal(ref value);
return value;
}
set
{
this.OnOrdinalChanging(ref value);
this.ReportPropertyChanging("Ordinal");
this._Ordinal = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("Ordinal");
this.OnOrdinalChanged();
}
}
private bool _Ordinal;
partial void OnGetOrdinal(ref bool value);
partial void OnOrdinalChanging(ref bool value);
partial void OnOrdinalChanged();
Not quite, there is no need to make any changes in the generated code.
You should open your .edmx model (if you are using Microsoft designer) using XML Editor you like and change the type of the property to bool in both SSDL and CSDL part of the model.
In case you are using Entity Developer it will be enough only to set the corresponding properties in design time (both in the Model and Store parts).
The code will be regenerated correctly, but any update made to the model by using Update from database wizard will overwrite the manual changes made to the model - this is a limitation of Microsoft designer. I recommend you to use Entity Developer.
You should open your .edmx model (if you are using Microsoft designer) using XML Editor you like and change the type of the property to bool in both SSDL and CSDL part of the model.
In case you are using Entity Developer it will be enough only to set the corresponding properties in design time (both in the Model and Store parts).
The code will be regenerated correctly, but any update made to the model by using Update from database wizard will overwrite the manual changes made to the model - this is a limitation of Microsoft designer. I recommend you to use Entity Developer.
-
- Posts: 10
- Joined: Mon 01 Mar 2010 20:17
- Contact: