当我试图获取CurrentSession时,我收到此错误
NHibernate.Context.CurrentSessionContext.CurrentSession()
Run Code Online (Sandbox Code Playgroud)
在
NHibernate.Impl.SessionFactoryImpl.GetCurrentSession()
Run Code Online (Sandbox Code Playgroud) 我正在开发我的第一个DDD应用程序并尝试遵循我在过去几个月中研究过的一些基本规则.
我用Nhibernate实现了存储库模式.
我以为我可以将我的实体从控制器"移动"到视图中,但很快我就意识到这几乎是不可能的.
大多数人似乎更喜欢定义特定于每个视图的视图模型.
我并不特别想要重新定义我已经为我的实体创建的字段,但似乎这是唯一的方法.
现在我面临着我想要附加一些验证规则的情况.
我以为我可以将验证规则(使用DataAnnotations)附加到实体,但如果我使用的是viewmodel则无法工作.
以下是问题:
我感谢任何帮助/建议.
我正在使用IExceptionLogger和ExceptionHandler为我的web api服务全局记录和错误处理.
现在有没有办法从ExceptionLoggerContext上下文中读取POST数据.?仅仅因为我想保存POST数据以及异常细节.
我是Asp.net开发人员,但对Asp.net Identity框架非常陌生.我一直在研究示例应用程序,并且在Identity上也遵循了一些教程,但我仍然无法完全掌握这个概念.我非常坚定地掌握Asp.net会员资格,但身份似乎与会员资格无关.我会解释到目前为止我做了什么.
我正在创建一个简单的应用程序,其中我遵循代码第一种方法.我为User创建了实体模型,它继承自IdentityUser并且有一些额外的字段.以下是User的实体模型.
public class User : IdentityUser
{
public int? CompanyID { get; set; }
public bool? CanWork { get; set; }
public bool? CanSearch { get; set; }
public Company Company { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
现在在示例中,人们使用名称ApplicationUser,但出于我自己的目的,我使用了名称User.User或ApplicationUser模型中还有一个方法,
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User> manager)
{
CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
Run Code Online (Sandbox Code Playgroud)
我无法理解这种方法的目的.同样从一个例子我使用以下模型的角色,
public class Role : IdentityRole
{
public Role()
{
}
public Role(string roleName, string description)
: base(roleName)
{ …Run Code Online (Sandbox Code Playgroud) 我是一个UI人,对离子框架很新.我想在我使用Ionic框架构建的android应用程序中添加搜索功能.经过研究,我发现我需要使用这个插件https://github.com/djett41/ionic-filter-bar.但没有详细的文件可用.任何人都可以指导如何使用此插件工作.我做了所有设置,但坚持使用实际代码.
我正在使用jqgrid 3.8.2,我正在尝试使用下面的代码从服务器端重新加载数据并显示特定页面,如当前页面.$( "#mygrid")setGridParam({数据类型:JSON})触发.( "reloadGrid",[{页:5}]); 网格可以正确地从服务器加载数据,但总是显示第一页而不是第5页.任何人都可以帮我一个忙吗?
关心西蒙
我正在构建一个使用令牌进行授权的web.api服务.我跟着他的博客使用多米尼克拜尔的准则在这里.
今天我已经更新了Owin,Entity Framework和ASP.NET web.api的所有软件包,我发现很多东西都已经改变了.
我在网上发现了一些文章(显然没有关于这些主题的文档)并开始转换我的web.api服务.
该职位有关的新的ASP.NET身份2.0.0帮我把几乎所有转变,但现在我被困在一个简单的愚蠢的事情.
我已经设法按照博客中的建议创建我的客户ApplicationUserManager和ApplicationDbContext.
在我的Startup中,我将我的2个对象与Owin Context相关联:
app.CreatePerOwinContext<ApplicationDatabaseContext>(ApplicationDatabaseContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
Run Code Online (Sandbox Code Playgroud)
我已经定义了一个自定义的OAuthAuthorizationServerProvider,因为我想使用Bearer身份验证:
var OAuthOptions = new OAuthAuthorizationServerOptions
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/oauth/Token"),
AccessTokenExpireTimeSpan = TimeSpan.FromHours(8),
Provider = new MyAuthorizationServerProvider(),
RefreshTokenProvider = new MyRefreshTokenProvider(DateTime.UtcNow.AddHours(8))
};
Run Code Online (Sandbox Code Playgroud)
在我的MyAuthorizationServerProvider中,我已经覆盖了ValidateClientAuthentication,因为我想检查客户端凭据.
一切似乎工作正常,我可以从OwinContext获取我的IAuthenticationManager:
public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
string clientId = string.Empty;
string clientSecret = string.Empty;
if (context.TryGetBasicCredentials(out clientId, out …Run Code Online (Sandbox Code Playgroud) 这有效,但它无法向下滚动到最底部.我在底部有主页按钮,很少有项目被它阻挡,不会向上滚动.主页按钮位于主页面的页脚中,而不是在同一个控制器上.我如何确保在底部看到所有图片.对任何建议表示赞赏.
<ion-scroll direction='y' zooming='true' style="height: 1024px">
<div class="favorites list item item-text-wrap" ng-repeat="photo in favorites">
<a class="item item-thumbnail-left" href="#">
<img src="sourceURL</p>
</a>
</div>
</ion-scroll>
Run Code Online (Sandbox Code Playgroud) 有人可以帮我创建一种从离子本地存储中删除的方法吗?
到目前为止我已经尝试过
set: function(key, value) {
$window.localStorage[key] = value;
},
get: function(key) {
return $window.localStorage[key];
},
setObject: function(key, value) {
$window.localStorage[key] = JSON.stringify(value);
},
getObject: function(key) {
return JSON.parse($window.localStorage[key]);
},
removeItem: function(key){
$window.localstorage.splice(key, 1);
}
Run Code Online (Sandbox Code Playgroud)
removeItem根本不起作用.我希望通过职位而不是按键删除.
ionic ×2
jqgrid ×2
angularjs ×1
asp.net-mvc ×1
c# ×1
javascript ×1
jquery ×1
nhibernate ×1
owin ×1
pagination ×1
reload ×1
viewmodel ×1