私のデータレイヤーのマイコードDtbseDropDown = ii.DtbseDropDownはエラーを投げています。私はそれを回避する方法がわかりません。エラーは次のようになります: "暗黙のうちに型 'boolを変換できませんか?' 「ブール」に。明示的な変換は、「ここboolを変換できませんか?ブールに
は、コードの私のデータ層のためのブロックとの私のエンティティ
データ層
public static List<ListProjectTypes> GetListProjectTypes()
{
using (var context = new Sys.EntityModels.HousingRehabEntities())
{
// build and execute query against the db
//return context.ListProjectTypes.Where(x => x.DtbseDropDown=true).ToList();
// build and execute query against the db
return (from ii in context.ListProjectTypes
where (ii.DtbseDropDown == true)
//&& ((ii.LastName + ii.FirstName + ii.Middle) != null))
////&& ((ii.LastName) != null))
orderby ii.SortOrder
select new Sys.Entities.ListProjectTypes
{
ProjectType = ii.ProjectType,
SortOrder = ii.SortOrder,
DtbseDropDown = ii.DtbseDropDown
}).ToList();
}
}
}
です(あなたはキャストが欠けている?)が存在しますエンティティ
namespace CityOfMesa.HousingRehab.Sys.Entities
{
public class ListProjectTypes
{
public string ProjectType { get; set; }
public int? SortOrder { get; set; }
public bool DtbseDropDown { get; set; }
public ListProjectTypes()
{
ProjectType = string.Empty;
SortOrder = 0;
DtbseDropDown = true;
}
}
}
[nullable boolを変換できますか? bool](http://stackoverflow.com/questions/6075726/convert-nullable-bool-to-bool) –