English 中文(简体)
利用国家扫盲中心
原标题:Using LINQ with NHibernate

奥基先生,我认为我所有的组合都是正确的,现在我只是试图从数据库中挑选一些数据。 现在,我正在使用3.0NHibernate,但因违约支持LINQ(或至少相当一部分链接)。 如今,每例准则都是一例。

session.Linq<User>()

但就我而言,我无法找到如何确定会议或会议地点。 为什么在3.0中这样做,如果是的话,我如何安排会议? 如果不是的话,用NHibernate 3.0使用LINQ的适当方法是什么?

最新资料:

现在我有以下法典:

var configuration = new Configuration();
configuration.Configure();
configuration.AddAssembly(typeof(Tag).Assembly);
var sessionFactory = configuration.BuildSessionFactory();
var session = sessionFactory.GetCurrentSession();

但是,我发现一个编辑错误,说NHibernate。 ISession没有林克的定义。 下面是:

using System.Collections.Generic;
using System.Web.Mvc;
using MyProject.Models;
using MyProject.ViewModels.Desktop;
using NHibernate.Cfg;

我失踪了吗?

最佳回答

你们需要进口名称空间:

using NHibernate.Linq;

Also, it s now:

session.Query<TEntity>();

而不是:

// Deprecated
session.Linq<TEntity>();
问题回答

页: 1 如果有的话,你可以使用总部电话查询、NH查询预报或LINQ获取数据。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签