0
votes

I have a db.edmx containing all the values from the database. Now initially I had the ID variables set to int, but since I started using Identity and wanting to link my tables into user ones I had to change the datatypes to nvarchar(128) I've done that, updated my tables from the database, and changed all my classes to string like:

public partial class average
    {
        public string id { get; set; }
        public string studentId { get; set; }
        public string classId { get; set; }
        public int value { get; set; }
        public System.DateTime date { get; set; }

        public virtual @class @class { get; set; }
    }

But for some reason the table mapping keeps being set to int32 like there:

enter image description here

Resulting in me getting an:

Error 2019: Member Mapping specified is not valid. The type 'Edm.Int32[Nullable=False,DefaultValue=]' of member 'id' in type 'DbModel.average' is not compatible with 'SqlServer.nvarchar[Nullable=False,DefaultValue=,MaxLength=128,Unicode=True,FixedLength=False,StoreGeneratedPattern=Identity]' of member 'id' in type 'DbModel.Store.averages'. gimBook C:\Users\Alan\documents\visual studio 2015\Projects\gimBook\gimBook\Models\Db.edmx 432

Another problem is that whenever I run Update Model from Database the .cs files automatically change all strings back into int.

Is there any way I could currectly update the mapping, so the values would work properly?

1

1 Answers

0
votes

FIXED: Deleting the db.edmx file, and reimporing it seemed to fix the issue