简体   繁体   English

如何修改使用DB-first Entity Framework创建的枚举

[英]How to modify an enumeration created with DB-first Entity Framework

I followed the directions as detailed in this answer , and my enumeration was saved and can be utilized throughout the app. 我遵循了此答案中详细说明的指示,并且我的枚举已保存并且可以在整个应用程序中使用。 But in the case that I wanted to add additional options or change the names of existing options, how do I that? 但是,如果我想添加其他选项或更改现有选项的名称,该怎么办?

I know I can do so by editing the EDMX file by hand in a text editor. 我知道可以通过在文本编辑器中手动编辑EDMX文件来做到这一点。 I'd rather do it within Visual Studio in a fashion similar to how I generated the enumeration to begin with if it's possible. 我宁愿在Visual Studio中以类似于在可能的情况下生成枚举的方式进行操作。

You can use the entity data model browser to update this. 您可以使用实体数据模型浏览器进行更新。 In your menu bar, navigate to View -> Other Windows -> Entity Data Model Browser . 在菜单栏中,浏览至View -> Other Windows -> Entity Data Model Browser I think you need to have your edmx file open to see this option. 我认为您需要打开edmx文件才能看到此选项。 That opens a model browser window and under the "Enum Types" folder you can double click your enum and update it. 这将打开一个模型浏览器窗口,在“枚举类型”文件夹下,您可以双击枚举并进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Entity Framework db-first 项目中添加非聚集索引? - How to add nonclustered indexes in Entity Framework db-first project? 实体框架DB-First,实现继承 - Entity Framework DB-First, implement inheritance 实体框架4 DB-First依赖注入? - Entity Framework 4 DB-First Dependency Injection? 努力单元测试实体框架6.1.3 DB-first - Effort unit testing Entity framework 6.1.3 DB-first ASP.NET Core DB-first Entity Framework Core 不能自动增加主键 - ASP.NET Core DB-first Entity Framework Core can not auto increment primary key 实体框架DB-First - 我可以从基础模型继承以添加我的功能吗? - Entity Framework DB-First - can I inherit from base model in order to add my functionality? 将实体(和相应的表)添加到EF DB优先模型 - Adding an entity (and respective table) to EF DB-first model DB-First Entity上下文是否必须匹配数据库模式,即使对于未使用的表也是如此? - Does an DB-First Entity context have to match the database schema, even for unused tables? EF DB-first映射混乱 - EF DB-first mapping mess 首先,实体框架数据库,如何添加实体关联? - Entity Framework DB first, How to add an entity association?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM