小编Cha*_*let的帖子

流畅的NHibernate,使用接口

我刚刚切换到Fluent NHibernate,我遇到了一个问题,但没有找到任何相关信息.

这是案例:

public class Field : DomainObject, IField
{
    public Field()
    {  
    }

    public virtual string Name { get; set; }
    public virtual string ContactPerson { get; set; }
    public virtual bool Private { get; set; }
    public virtual IAddress Address { get; set; }  
}
Run Code Online (Sandbox Code Playgroud)

IAddress是由名为Address的类实现的接口

public class Address : DomainObject, IAddress
{
    public Address()
    {
    }

    public virtual string City { get; set; }
    public virtual string Country { get; set; }
    public virtual string PostalCode { …
Run Code Online (Sandbox Code Playgroud)

c# mapping nhibernate fluent interface

31
推荐指数
2
解决办法
1万
查看次数

使用FakeItEasy的Out和Ref参数

我有一个方法,其out参数返回许多记录.我想知道如何用FakeItEasy来嘲笑它.

.net c# tdd mocking fakeiteasy

25
推荐指数
1
解决办法
4375
查看次数

使用Bonobo在IIS上托管的GIT问题

我们使用IIS7在网络服务器上安装了Bonobo Git Server.

一切似乎工作正常,我们创建存储库,我们克隆它们,但是当我们尝试推送时,我们有这个错误:

$ git push origin master
Username:
Password:
Counting objects: 3985, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3561/3561), done.
Writing objects: 100% (3984/3984), 24.67 MiB | 7.70 MiB/s, done.
Total 3984 (delta 645), reused 0 (delta 0)
fatal: protocol error: bad line length character: <!DO
fatal: The remote end hung up unexpectedly
fatal: write error: Invalid argument
Run Code Online (Sandbox Code Playgroud)

它发生在我们进行大型提交时,通常是我们的初始提交.

如果我提交像readme.txt这样的juste就可以了.

我们的大多数回购都是从SVN迁移,我们现在正在使用它大约2周,一切都很顺利,直到我们开始一个新项目并做了一个很大的初始提交.

我没有通过谷歌搜索错误找到任何有用的东西.

我还将我的git.config修改为:

[http]
    postBuffer = 524288000
    sslVerify = false
Run Code Online (Sandbox Code Playgroud)

但它并没有解决我的问题.

非常感谢,

查尔斯

windows git iis-7 bonobo

24
推荐指数
1
解决办法
7409
查看次数

使用ssh-keygen创建SSH密钥不会创建.ssh文件夹

我正在尝试使用msysgit创建我的公共/私有rsa密钥对

我运行这个命令:

ssh-keygen -C "email@email.com" -t rsa
Run Code Online (Sandbox Code Playgroud)

一切都很好,我有消息

Enter file in which to save the key (/c/Users/user/.ssh/id_rsa)
Run Code Online (Sandbox Code Playgroud)

然后我得到确认:

Your public key has been saved in project.pub
Run Code Online (Sandbox Code Playgroud)

但我无法访问该文件夹!它不存在,甚至不是隐藏文件夹.我不明白为什么它不生成.我正在使用Windows 7旗舰版.

git ssh version-control mingw unfuddle

21
推荐指数
5
解决办法
4万
查看次数

为具有多个项目的解决方案创建nuget包

我们目前正在构建包含多个项目的解决方案.

我们有这样的事情:

- Common
  - Logging
     - Logging.NLog
- Threading
Run Code Online (Sandbox Code Playgroud)

所以Logging.NLog依赖于Logging,Logging on Common等.

当我们打包Logging.NLog时,我希望nuget能够发现Loggin和Common dependecies.

此刻,我用Common创建了一个包,然后在Logging中我安装了包Common

install-package Common
Run Code Online (Sandbox Code Playgroud)

但每当我对Common进行修改时,我都必须更新包,它们是由我们的连续集成系统(Hudson)创建的,所以当我们开发时它非常烦人.

我想简单地有一个项目参考(添加引用 - >项目...),并且nuget无论如何都会发现依赖项.

有没有办法实现它?

.net c# dependencies nuget nuget-package

16
推荐指数
1
解决办法
2万
查看次数

AZCopy:设置文件Content-Type

我们尝试在部署脚本中使用AZCopy将一些资产直接上传到我们的存储中,该存储通过Azure上的CDN公开.

当我们上传文件时,Content-Type是application/octet-stream我们需要能够通过示例指定的text/javascript

有没有办法实现这个目标?我们不必为每种文件类型多次调用AZCopy.

azure azcopy

11
推荐指数
2
解决办法
4075
查看次数

流利的NHibernate,varbinary(最大)和SQLite

我的sql server数据库中有一个varbinary字段,需要varbinary(max).我使用NHibernate创建数据库,并使用Fluent Nhibernate作为映射.

我也使用SQLite进行单元测试,我使用相同的映射我只是在内存中创建数据库之前更改配置.

我遇到以下问题.

我创建了这个扩展方法:

 public static IProperty WithMaxVarBinaryLength(this IProperty propertyMap)
 {
     return propertyMap.CustomSqlTypeIs("varbinary(max)");
 }
Run Code Online (Sandbox Code Playgroud)

它在我的网站上工作正常,数据库是用varbinary(max)字段创建的,但是当我运行单元测试时,我得到以下异常

System.Data.SQLite.SQLiteException: SQLite error near "max": syntax error
Run Code Online (Sandbox Code Playgroud)

然后我在stackoverflow的另一个问题中发现我们可以这样做来创建一个varbinary(max):

public static IProperty WithMaxLength(this IProperty propertyMap)
{
    return propertyMap.WithLengthOf(1000);
}
Run Code Online (Sandbox Code Playgroud)

但是我得到了这个例外:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Content is not a string. at FluentNHibernate.Mapping.PropertyMap.WithLengthOf(Int32 length) in d:\Builds\FluentNH\src\FluentNHibernate\Mapping\PropertyMap.cs:line 166
Run Code Online (Sandbox Code Playgroud)

目前我不知道,我不想手动创建所有数据库脚本,我想继续使用SQLite进行单元测试.

谢谢您的帮助.

顺便说一句,这是我的完整映射,请注意我使用了我的扩展方法.

public class AttachmentFileMap : ClassMap<AttachmentFile>
{
    public AttachmentFileMap()
    {
        WithTable("AttachmentFiles");

        Id(x => x.Id).GeneratedBy.Identity();
        Map(x => x.Content).WithMaxVarBinaryLength();
        Map(x …
Run Code Online (Sandbox Code Playgroud)

.net c# mapping nhibernate fluent-nhibernate

7
推荐指数
2
解决办法
4122
查看次数

从递归模型创建表单

我有一个像这样的递归模型:

public class Node
{
    public int Id { get; set; }
    public string Text { get; set; }
    public IList<Node> Childs { get; set; }

    public Node()
    {
        Childs = new List<Node>();
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码构建一个带有剃刀视图的树:

<ul>
    @DisplayNode(Model)
</ul>

@helper DisplayNode(Node node) {
    <li>
        @node.Text

        @if(node.Childs.Any())
        {
            <ul>
                @foreach(var child in node.Childs)
                {
                    @DisplayNode(child)
                }
            </ul>
        }
    </li>
}
Run Code Online (Sandbox Code Playgroud)

一切正常,我的树呈现,但我需要在树的每一行添加一个文本框,我想要输入这样的名称:

Childs[0].Childs[1].Childs[2].Text
Run Code Online (Sandbox Code Playgroud)

所以我的模型绑定将按预期工作.

有没有办法使用EditorTemplates或其他任何方法来实现这一目标?

我想避免在表单提交的javascript中构建输入名称.

asp.net-mvc recursion razor asp.net-mvc-3

7
推荐指数
1
解决办法
2084
查看次数

ASP.NET MVC ActionFilterAttribute在模型绑定之前注入值

我想创建一个自定义操作过滤器属性,在属性绑定期间可以访问的HttpContext项中添加一个值.

我试图在OnActionExecuting中添加它,但似乎模型绑定在过滤器之前被激活.

你知道我怎么做吗?也许在模型绑定器中有一个方法我可以覆盖它将在过滤器之后触发并使用我的过滤器注入的值.

我想做的是注入验证上下文(我用于验证的库支持上下文,它是nvalid.net(www.nvalid.net)

我希望能够放置一个属性,如

[ValidationContext("Prevalidation")]
Run Code Online (Sandbox Code Playgroud)

在我的actionresult方法上,以便我的自定义模型绑定器中发生的验证可以知道在执行验证时使用哪个上下文.

这就是我不能简单地制作自定义模型装订器的原因.

.net c# asp.net asp.net-mvc asp.net-mvc-3

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

FluentNhibernate和SQLite

我无法在我的sessionfactory中使用SQLite Driver.

我从http://sqlite.phxsoftware.com/下载了SQLite 1.0.48

我在Tests项目中添加了对System.Data.SQLite的引用.

public static IPersistenceConfigurer GetSqlLiteConfigurer()
        {
            try
            {
                return SQLiteConfiguration
                .Standard
                .InMemory();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Run Code Online (Sandbox Code Playgroud)

这就是我生成配置器的方法

问题是,当我构建我的sessionfactory时,我收到以下错误:

NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name …
Run Code Online (Sandbox Code Playgroud)

sqlite nhibernate unit-testing system.data.sqlite fluent-nhibernate

5
推荐指数
2
解决办法
4352
查看次数