Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 列表(型号)工厂中的列表_C#_Asp.net Mvc 3_Nhibernate - Fatal编程技术网

C# 列表(型号)工厂中的列表

C# 列表(型号)工厂中的列表,c#,asp.net-mvc-3,nhibernate,C#,Asp.net Mvc 3,Nhibernate,我想在数据列表中创建数据列表。我相信这很难解释,但我会尽量把我的问题解释清楚。我创建了数据列表,但在此列表中,一些参数也是数据列表。我必须使用此代码编写,因为这是限制(我们的工厂)。如果我获取的数据不是数据列表,那么一切都正常。问题在哪里?若我在列表中写入列表,我会得到错误。也许你能看出我的错误 程序是可编译的 问题(我使用NHibernate中的映射从第三个表中获取数据): 重要: public IEnumerable<DictionaryListModel> OnList(Dic

我想在数据列表中创建数据列表。我相信这很难解释,但我会尽量把我的问题解释清楚。我创建了数据列表,但在此列表中,一些参数也是数据列表。我必须使用此代码编写,因为这是限制(我们的工厂)。如果我获取的数据不是数据列表,那么一切都正常。问题在哪里?若我在列表中写入列表,我会得到错误。也许你能看出我的错误

程序是可编译的

问题(我使用NHibernate中的映射从第三个表中获取数据):

重要:

public IEnumerable<DictionaryListModel> OnList(DictionayDisplayModel dictionary DisplayModel, int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
{
var displayModel = (DictionaryNewInfoDisplayModel)dictionaryDisplayModel;
if (displayModel == null)

var list = _dictImportantInformation.GetList().Select(
x=> new DictionaryNewInfoListModel
    {
        Id = x.Id
        Description = x.Description,
        IsActiveYN = x.IsActive,
        DestynationName = (List<DictionaryNewInfoSupportList>) x.DictImportantInformationXDestination.Select(n => new DictionaryNewInfoSupportList 
        { Id = n.Destination.Id, Name = Destination.Description}).To.List()
    }
    ).ToList();

return list;

}

将此作为答案并接受它,关闭主题的最佳方式请按照@dove request的程序进行。这个问题仍然没有回答,但你自己回答了(这很好)。因此,点击“回答你自己的问题”,将其添加为答案,两天后(我认为)你将能够接受它作为答案并将其从列表中删除。
public Ilist<dictionaryNewInfoSupportList> DestynationName;
class dictionaryNewInfoSupportList
{
public string Name {get; set;}
public int Id {get; set;}
}
public IEnumerable<DictionaryListModel> OnList(DictionayDisplayModel dictionary DisplayModel, int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
{
var displayModel = (DictionaryNewInfoDisplayModel)dictionaryDisplayModel;
if (displayModel == null)

var list = _dictImportantInformation.GetList().Select(
x=> new DictionaryNewInfoListModel
    {
        Id = x.Id
        Description = x.Description,
        IsActiveYN = x.IsActive,
        DestynationName = (List<DictionaryNewInfoSupportList>) x.DictImportantInformationXDestination.Select(n => new DictionaryNewInfoSupportList 
        { Id = n.Destination.Id, Name = Destination.Description}).To.List()
    }
    ).ToList();

return list;

}
var list = _dictImportantInformation.GetList().ToList().Select(
            x => new DictionaryNewInfoListModel
                     {
                         Id = x.Id,
                         Description = x.Description,
                         IsActiveYN = x.IsActive,
                         DeestynationName = x.DictImportantInformationXDestination.Select(n => new DictionaryNewInfoSupportList 
                         { Id = n.Destination.Id, Name = n.Destination.Description }).ToList()
                     }

            ).ToList();
var list = _dictImportantInformation.GetList().ToList().Select(
            x => new DictionaryNewInfoListModel
                     {
                         Id = x.Id,
                         Description = x.Description,
                         IsActiveYN = x.IsActive,
                         DeestynationName = x.DictImportantInformationXDestination.Select(n => new DictionaryNewInfoSupportList 
                         { Id = n.Destination.Id, Name = n.Destination.Description }).ToList()
                     }

            ).ToList();