public enum Status
{
Pending,
[EnumMember(Value = "In Progress")]
InProgress,
Failed,
Success
}
string dbValue = "In Progress";
if (dbValue == ValueOf(Status.InProgress)){
//do some thing
}
Run Code Online (Sandbox Code Playgroud)
我怎么读Status.InProgress的价值所以我回来了"进行中"?
我有一张员工桌子和EmployeeCourseStatus桌子.
我想显示每个员工的列表,其中包含已完成的课程数(status = "CMP").
我有以下相关子查询,导致以下错误:
var query = (from emp in Employee
join adr in EmployeeAddress on emp.id = adr.EmployeeID
select new
{
id = emp.id,
name=emp.name,
country=adr.country,
CompletedCourseCount = (from c in employeeCourseStatus where c.empid = emp.id && c.status == "CMP" select c.id).count()
}
Run Code Online (Sandbox Code Playgroud)
错误:
仅支持Premitive类型.
等效的SQL子查询将是 -
Select emp.id
, emp.name
, adr.Country
, CompletedCourseCount = (select count(id) from EmployeeCourseStatus where id = emp.id and status = "CMP")
from Employee emp
JOIN employeeaddress adr …Run Code Online (Sandbox Code Playgroud)