我对nHibernate有一个奇怪的问题......我得到了这个异常:
Unable to resolve property: _Portal
Run Code Online (Sandbox Code Playgroud)
当我尝试提交对象图时.奇怪的是,当我在整个解决方案搜索,我似乎没有这个特定属性ANYWHERE项目中?
有没有人遇到过这种特殊情况,如果有的话,他们做了什么来解决?
正如我在标题中所说,我想实现每个Web请求的会话.我的会话提供程序配置如下(我对改变此conf不感兴趣.)
public class SessionProvider
{
public static SessionProvider Instance { get; private set; }
private static ISessionFactory _SessionFactory;
static SessionProvider()
{
var provider = new SessionProvider();
provider.Initialize();
Instance = provider;
}
private SessionProvider()
{
}
private void Initialize()
{
string csStringName = "ConnectionString";
var cfg = Fluently.Configure()
....ommiting mappings and db conf.
.ExposeConfiguration(c => c.SetProperty("current_session_context_class", "web"))
.BuildConfiguration();
_SessionFactory = cfg.BuildSessionFactory();
}
public ISession OpenSession()
{
return _SessionFactory.OpenSession();
}
public ISession GetCurrentSession()
{
return _SessionFactory.GetCurrentSession();
}
}
Run Code Online (Sandbox Code Playgroud)
在Global.asax.cs中,我有以下与每个Web请求的会话相关的代码.
private static ISessionFactory …Run Code Online (Sandbox Code Playgroud) nhibernate asp.net-mvc fluent-nhibernate session-per-request
我需要知道如何知道给定表的SQL Server数据库中最后插入的id是什么?
我使用的int identity不是guid,如果将NHibernate作为我的ORM则很重要.
谢谢
我正在尝试将jquery onclick确认对话框实现到我的mvc3删除操作.值得一提的是我是succ.渲染对话框本身,我在努力的是在单击继续按钮后从js /用户/删除操作的进程操作.这是代码:
onclick-delete.js
$(function () {
var deleteLinkObj;
// delete Link
$('.delete').click(function () {
deleteLinkObj = $(this); //for future use
$('#delete-dialog').dialog('open');
return false; // prevents the default behaviour
});
//definition of the delete dialog.
$('#delete-dialog').dialog({
autoOpen: false, width: 400, resizable: false, modal: true, //Dialog options
buttons: {
"Continue": function () {
$.post(deleteLinkObj[0].href, function (data) { //Post to action
// THIS IS WHERE I SHOULD SEND DATA TO MY DELETE ACTION (Users/Delete)
else {
alert("error");
}
});
$(this).dialog("close");
},
"Cancel": …Run Code Online (Sandbox Code Playgroud) 我正在使用ajax json返回一些数据.使用json返回的对象具有我需要渲染的图像路径.这是我的js函数里面的代码
data = '<div class="articleWrapper"><div class="articleImgThumb">' + '<img src="'+item.ImagePath;'" />' + '</div></div>';
Run Code Online (Sandbox Code Playgroud)
我做错了什么导致这个代码在我的视图中呈现为
<div class="articleWrapper">
<div class="articleImgThumb"> // here should be img src code </div>
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢