Issuewith NHibernate的,流利的NHibernate和Iesi.Collection。你会尝试下呢? [英] Issuewith NHibernate, Fluent NHibernate and Iesi.Collection. What would you try next?

查看:458
本文介绍了Issuewith NHibernate的,流利的NHibernate和Iesi.Collection。你会尝试下呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常新的NHibernate的,所以我很抱歉,如果我失去了一些东西在这里小事。我目前通过从packtpub名为NHibernate的3初学者指南一书的工作。我主要是按照书中的指示。当我说主要是我已经使用MySQL而不是MSSQL分歧,并一直在使用的NuGet而不是手工下载的二进制文件。

I'm extremely new to NHibernate so I apologize if I missing something trivial here. I am currently working through a book titled "NHibernate 3 Beginners Guide" from packtpub. I have mostly been following the directions in the book. When I say mostly I have diverged by using MySQL instead of MSSQL and have been using NuGet rather than downloading the binaries by hand.

我在第2章的这是第一个真正的编码章的时刻。在这一章我建立一个简单的WPF应用程序通过点击一个按钮来建立我的数据库架构。我已经建立了一些POCO的为产品一章中规定类别类。通过的NuGet我已经添加了以下参考资料:

I am in Chapter 2 at the moment which is the first real coding chapter. In this chapter I am building a simple WPF application to build my database schema through a button click. I have already built some POCO's for the Product and Category classes specified in the chapter. Through NuGet I have added the following references:


  1. MySQL.Data

  2. NHibernate的(作为一个依赖自动解决,Iesi.Collections)

  3. 功能NHibernate

当我点击按钮来构建我的数据库下面的代码块被执行:

When I click the button to build my database the following code block is executed:

private const string connString = "string omitted for brevity";

private void btnCreateDatabase_Click(object sender, RoutedEventArgs e)
    {
        Fluently.Configure().Database(MySQLConfiguration.Standard.ConnectionString(connString))
            .Mappings(m => m.FluentMappings.AddFromAssemblyOf<ProductMap>())
            .ExposeConfiguration(CreateSchema)
            .BuildConfiguration();
    }



当点击我收到以下异常按钮( FileLoadException ):

外异常消息:无法加载文件或程序集Iesi.Collections,版本= 4.0。 0.0,文化=中性公钥= aa95f207798dfdb4'或它的一个依赖。找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040)

内部异常消息:无法加载文件或程序集Iesi.Collections,版本= 1.0.1.0,文化=中性公钥= aa95f207798dfdb4'或它的一个依赖。找到的程序集清单定义不匹配程序集引用。 (异常来自HRESULT:0x80131040)

下面是融合日志是否有帮助:

Here is the "Fusion Log" if that helps:

=== Pre-bind state information ===
LOG: User = Borealis\Frito
LOG: DisplayName = Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Frito/documents/visual studio 2010/Projects/NH3BeginnersGuide/Chapter2/App/Sample.UI/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Frito\documents\visual studio 2010\Projects\NH3BeginnersGuide\Chapter2\App\Sample.UI\bin\Debug\Sample.UI.vshost.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.1.0 redirected to 4.0.0.0.
LOG: Post-policy reference: Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Users/Frito/documents/visual studio 2010/Projects/NH3BeginnersGuide/Chapter2/App/Sample.UI/bin/Debug/Iesi.Collections.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.



我曾尝试以下和现在的有点不知所措的:

I have tried the following and now am at a bit of a loss:


  1. 通过的NuGet尝试升级Iesi.Collections但失败说没有NHibernate的一个版本是兼容的。

  2. 下载了NHibernate和FluentNhibernate二进制文件和手动引用它们。

  3. 从书和复制在样品中的DLL拉动源样本。这给了我,我还没有研究远远不够,提问又一个不同的错误

我有两个问题:


  1. 首先,为什么会的NuGet包试图寻找一个版本4 * DLL时版本该船点回到1 *?

  2. 我应该尝试短期的工作让所有的源和当地建设什么其他的事情?我在一个有点损失,他会喜欢一些其他输入。提前

谢谢!

推荐答案

圣poopers这驱使我坚果。我发现,的app.config 在某一点产生,大概是因为我的东西搞乱。在的app.config 我发现了以下内容:

Holy poopers this drove me nuts. I found that an app.config was created at some point, presumably as I was messing with something. In the app.config I found the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>



注释掉运行元素,重建和允许运行上面的按钮才能正常工作。我不知道我做了什么,使这个以获取生成,但我很高兴我发现了它。感谢所有努力为您提供协助和感谢的问题给予好评!

Commenting out the Runtime element, rebuilding and running allowed the button above to function properly. I'm not sure what I did to cause this to get generated but I'm glad I found it. Thanks all for your efforts to assist and thanks for the upvote on the question!

这篇关于Issuewith NHibernate的,流利的NHibernate和Iesi.Collection。你会尝试下呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆