c# - EF 6.1 and maintaining views -


yesterday asked question: generating sql view ef 6.1 code first

and thought working fine, though still have troubles when generating new migration. when generate new one, ef sees changes or irregularities in views wants changes. but, far know view's columns c.q. primary key aren't changable?

 dropprimarykey("dbo.myview1");  dropprimarykey("dbo.myview2");  altercolumn("dbo.myview1", "name", c => c.string(maxlength: 255, unicode: false));  altercolumn("dbo.myview1", "secondname", c => c.string(maxlength: 255, unicode: false));  altercolumn("dbo.myview1", "multiplenames", c => c.string(maxlength: 255, unicode: false));  altercolumn("dbo.myview2", "price", c => c.decimal(nullable: false, precision: 18, scale: 2));  altercolumn("dbo.myview2", "typename", c => c.string(maxlength: 255, unicode: false));  addprimarykey("dbo.myview1", "id");  addprimarykey("dbo.myview2", "id"); 

does knows solution this?

i thought @ first myview1.name field wasn't equal view field. in database field normal: varchar(255) not null en in code it's string max length of (255).

so don't see how avoid generation? ideas?

edit:

the 1 understand myview2.price field, decimal(standard 18,2) in code. , decimal(19,4) in database. can fixed while changing model. strings?? still no idea..

solved: solving decimal issue automatically resolve other issues.

it seems id's dropped , created make possible renaming? , prevent errors.

still i'm not sure though.. why string issue created..

note: can see previous post, generated models exisiting database. before doing adding new migration, sure remove [key] attributes in model of sql view. seems part of solution


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -