小编Luk*_*uka的帖子

JoinQueryOver和JoinAlias有什么区别?

我需要知道JoinQueryOver和JoinAlias之间的区别是什么,以及何时使用它们?

谢谢.

nhibernate queryover

86
推荐指数
2
解决办法
3万
查看次数

Visual Studio 2017新版.csproj InternalsVisibleTo

在新的Visual Studio 2017 .csproj项目文件中从AssemblyInfo放置InternalsVisibleTo的位置?

msbuild csproj assemblyinfo visual-studio-2017

42
推荐指数
3
解决办法
8445
查看次数

如何使用新的 Windows 终端作为 Visual Studio 调试控制台

如何将新的 Windows 终端应用程序设置为在 Visual Studio 2019 中用作调试控制台?默认情况下,它会cmd.exe在我调试时启动。

console visual-studio windows-terminal

25
推荐指数
2
解决办法
4599
查看次数

Visual Studio 2017新的.csproj是否与非.net核心项目相关

我有点困惑.我有Visual Studio 2017的新版本.并已将我的类项目(.net full 4.5)转换为新的.csproj项目格式.然后我尝试对这些项目进行实时测试,但VS现在告诉我.net核心项目jet不支持实时测试.

所以:

  1. 这些项目现在是.Net核心项目吗?
  2. 如果是,我可以将新的.csproj项目文件用于旧的.Net Full 4.x
  3. 我打算将我的应用程序作为WebApi服务部署到Windows服务器,我打算使用NHibernate ORM,因此不包括对.net Core的移动,对我的情况使用这种新的.csproj格式有什么好处吗?
  4. 我可以使用新的.csproj格式并继续使用非.Net Core兼容库,如NHibernate吗?

谢谢

.net csproj visual-studio-2017

11
推荐指数
1
解决办法
1981
查看次数

Aurelia + Select2自定义元素未传播选定已更改

我在Aurelia创建了一个自定义元素.

import {bindable, inject, customElement, bindingMode} from 'aurelia-framework';
import 'select2';
import * as $ from 'jquery';
import {BindingSignaler} from "aurelia-templating-resources";

@customElement('select2')
@inject(Element, BindingSignaler)
export class Select2CustomMultiselect {
    @bindable name = null;    // name/id of custom select
    @bindable selected = null;  // default selected values
    @bindable ({defaultBindingMode: bindingMode.oneWay, attribute:"options"}) source:Array<{id:number, name:any}>= [];   // array of options with id/name properties
    @bindable placeholder = "";
    @bindable allow_clear = true;
    private $select2: $;

    constructor(private element, private signaler:BindingSignaler) {
    }

    attached() {
        let $select = …
Run Code Online (Sandbox Code Playgroud)

binding custom-element aurelia select2 aurelia-framework

9
推荐指数
1
解决办法
489
查看次数

如何添加针对完整.Net Framework 4.7的Asp.Net Core 2.0的Docker支持

我有一个针对.Net Framework 4.7(完整版)的ASP.Net Core 2.0应用程序.我想使用Docker,但VS 2017 15.5不允许我添加Docker支持.(这不支持喷射).我的问题是:有没有解决这个问题的方法.如果没有,我还能以某种方式在这个项目中使用docker并在VS 2017中进行调试吗?请帮忙谢谢

更新 我需要使用.NET完整版,因为我使用的第三方库不像NHibernate一样支持.net核心,我不想使用EF Core.此外,我正在构建微服务架构,并希望每个mecroservice都部署在自己的容器中.

.net docker visual-studio-2017 asp.net-core-2.0

9
推荐指数
1
解决办法
913
查看次数

如何在nhibernate中从wcf获取经过身份验证的用户标识

我已经实现了NHibernate自定义上下文(ICurrentSessionContext).在这个上下文中,我注入NHibernate会话,所以我有每个调用模式设置Session.好的,现在我已经制作了一个拦截器,它接受当前登录用户的userId.现在我这样做:

public ISession CurrentSession()
{
  // Get the WCF InstanceContext:
  var contextManager = OperationContext.Current.InstanceContext.Extensions.Find<NHibernateContextManager>();
  if (contextManager == null)
  {
    throw new InvalidOperationException(
      @"There is no context manager available.
      Check whether the NHibernateContextManager is added as InstanceContext extension.
      Make sure the service is being created with the NhServiceHostFactory.
      This Session Provider is intended only for WCF services.");
   }

   var session = contextManager.Session;
   AuditLogInterceptor interceptor = new AuditLogInterceptor();
   if (session == null)
   {
     session = this._factory.OpenSession(interceptor);
     interceptor.Session = session;

     contextManager.Session = session; …
Run Code Online (Sandbox Code Playgroud)

nhibernate session wcf interceptor

6
推荐指数
1
解决办法
1293
查看次数

Depencency注入问题

我有一个关于依赖注入模式的问题.我的问题是......如果我去构造函数注入,为我的类注入依赖项,我得到的是一个有很多参数的"大"构造函数.如果是的话.我在某些方法中不使用某些参数?IE浏览器.我有一个暴露许多方法的服务.以及一个包含10个参数(所有依赖项)的构造函数.但并非所有方法都使用所有依赖项.某些方法只使用一个依赖项,另一个方法将使用3个依赖项.但即使使用非容器,DI容器也会解决所有问题.

对我来说,这是使用DI容器的性能损失.这是真的?

constructor dependency-injection

6
推荐指数
2
解决办法
139
查看次数

回滚后的NHibernate 3会话状态()

我有个问题.

using (var tran = repository.Session.BeginTransaction())
{
    try
    {
        repository.Save(entity);
        tran.Comit();
    }
    catch(Exception)
    {
        tran.Rollback();
        throw;
    }    
}

using (var tran = repository.Session.BeginTransaction())
{
    try
    {
        repository.GetById(id);
        tran.Comit();
    }
    catch(Exception)
    {
        tran.Rollback();
        throw;
    }    
}
Run Code Online (Sandbox Code Playgroud)

当我尝试在异常之后和tran.rollback()第一个using块中通过ID获取实体时,我得到更新异常.所以NHibernate试图从using第二个using块的第一个块更新实体.

为什么?我做了tran.Rollback().我也必须这样做Session.Clear()吗?

nhibernate session transactions rollback

6
推荐指数
1
解决办法
4814
查看次数

NHibernate QueryOver与众不同

我有这种情况:

class User
{
Id,
UserName
}

class UserRelationship
{
User GroupUser,
User MemberUser
}

and query

var query = QueryOver.Of<UserRelationship>()
.JoinqueryOver(x=>x.MemberUser)
.Where(x=>x.UserName == "TestUser");
Run Code Online (Sandbox Code Playgroud)

现在我想返回List Distinct User,所以我不能这样做

TransformUsing(Transformers.DistinctRootEntity)

因为这会给我UserRelationship.

我需要这样的东西:

Select distinct user.ID 
from UserRelationship relationship
inner join User user on user.ID = relationship.MemberUser_ID
Run Code Online (Sandbox Code Playgroud)

请帮助谢谢

nhibernate distinct queryover

6
推荐指数
1
解决办法
4871
查看次数