开发者

binary propery in EF4 with mysql -- datatype

I am using mysql together wi开发者_如何学JAVAth EF4 and VS2010. I am using model first and uses the Generate database from model function to create the database.

Problem is that the binary properties in the model is converted to varbinary(100). I need them to be converted to MEDIUMBLOB.

I know I can change this manually but it would be really great if this could be done automaticly.


Is one-time mapping change automatically enough? ;-)

You can do this in model designer, just select Table mappings from Entity RMB menu, .

EDIT:

That is weird, but it looks like actually Table Mappings does not allow to change mapping types.

Anyway, what you can do is to change T4 template to generate SQL. To do this, find file:

VS_BASE_DIR\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGenSSDLToSQL10.tt

and modify line 165 to return proper SQL Type name instead of the one returned by ToStoreType() extension method of EdmProperty. Unfortunately I didn't find a way to modify it directly.

Of Course this will modify settings for all further projects. If that is not desired, you can make a copy of original template and chose right one through EF Model Properties\DDL Generation Template in every project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜