简体   繁体   English

在ComboBox / DropDown列表控件的Lightswitch中使用EF的枚举

[英]Using EF's Enum's in Lightswitch in ComboBox/DropDown list control

I have created the following tables: 我创建了以下表格:

在此处输入图片说明

The Role in the AccountContact table is the following enum: AccountContact表中的角色是以下枚举:

public enum UserRoles : int
{
    Admin = 0,
    AccountAdmin = 1,
    AccountUser = 2,
    SiteAdmin = 3,
    SiteUser = 4,
    User = 5,
    None = 6
}

In Lightswitch, I've added the database created from the EF design but the Role is int in the data-source table and not the enum. 在Lightswitch中,我添加了从EF设计创建的数据库,但角色在数据源表中而不是枚举中,而int在数据源表中。 How do I create the drop-down for lightswitch of the enum and selection to be the resulting int? 如何创建枚举的lightswitch的下拉列表并将其选择为结果int?

Even though EF5 now supports enums, that doesn't automatically mean that LightSwitch also supports them. 尽管EF5现在支持枚举,但这并不意味着LightSwitch也支持它们。

I'm not using LS 2012 yet, so I can't confirm this, but it's likley to be your problem. 我尚未使用LS 2012,因此无法确认,但这是您的问题。 I don't remember hearing that enum support had been introduced into LightSwitch. 我不记得曾听说过将枚举支持引入LightSwitch。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM