Can not find ObjectHandler.

Nov 15, 2010 at 12:37 PM
我照以下修改了程序,
  • Replace "Lephone.Util" to "Lephone.Core".
  • Replace "IoC" to "Ioc".
  • Change the models to remove all the abstract.

我使用最新的dbEntry升级了程序,发现下面异常,,,是不是最新的还没通过测试,还是我哪里没使用对,

 

[TeacherManager.BLL.Teacher]Can not find ObjectHandler.

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: Lephone.Data.ModelException: [TeacherManager.BLL.Teacher]Can not find ObjectHandler.

源错误:

行 375:        {
行 376:            var pass = Teacher.GetHashedPassword(password);
行 377:            var u = Teacher.FindOne(CK.K["UserName"] == name);//p.Username == name
行 378:            if (u != null && u.Password != pass)
行 379:            {


源文件: D:\SchoolWeb\TeacherManager\BLL\Teacher.cs    行: 377

堆栈跟踪:

[ModelException: [TeacherManager.BLL.Teacher]Can not find ObjectHandler.]
   Lephone.Data.Common.ObjectInfoBase.CreateDbObjectHandler(Type sourceType) +417
   Lephone.Data.Common.ObjectInfoBase.get_Handler() +86
   Lephone.Data.Common.QueryComposer.GetSelectStatement(DbDialect dialect, FromClause from, Condition iwc, OrderBy oc, Range lc, Boolean isDistinct, Type returnType) +133
   Lephone.Data.DbContext.DataLoad(IProcessor ip, Type returnType, Type dbObjectType, FromClause from, Condition iwc, OrderBy oc, Range lc, Boolean isDistinct) +66
   Lephone.Data.DbContext.GetObject(Type t, Condition c, OrderBy ob, Range r) +69
   Lephone.Data.DbContext.GetObject(Condition c) +78
   Lephone.Data.DbEntry.GetObject(Condition c) +108
   Lephone.Data.Definition.DbObjectModelBase`2.FindOne(Condition con) +43
   TeacherManager.BLL.Teacher.GetUserForLogin(String name, String password) in D:\SchoolWeb\TeacherManager\BLL\Teacher.cs:377
   TeacherManager.BLL.Teacher.ValidateUser(String name, String password) in D:\SchoolWeb\TeacherManager\BLL\Teacher.cs:393
   Login.Button1_Click(Object sender, EventArgs e) in d:\SchoolWeb\TeacherManager\WebSite\Login.aspx.cs:36
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

Coordinator
Nov 15, 2010 at 2:26 PM

最近没有更新文档,要升级到最新源代码,还要修改 Model 所在的 csproj 文件,参考 Lephone.UnitTest.csproj,在其中加入:

  <UsingTask TaskName="ProcessorTask" AssemblyFile="$(SolutionDir)Lephone.MSBuild\bin\$(ConfigurationName)\Lephone.MSBuild.dll" />
  <Target Name="AfterCompile">
    <ProcessorTask KeyFile="$(KeyOriginatorFile)" ProjectDir="$(ProjectDir)" AssemblyName="@(IntermediateAssembly)" SolutionDir="$(SolutionDir)" />
  </Target>

另外,如果 Model 引用了 GAC 之外的 DLL 的话,也要复制此 dll 到 Lephone.MSBuild.dll 所在目录。

Aug 25, 2012 at 1:51 PM

我的也是出现这个问题。我是直接将我的web项目中的model层、控制层引用Lephone.core.dll,Lephone.data.dll这两个文件,而且web.config文件也按文档配置了。可是在执行DbEntry.Save(entity)时还是出现“ Can not find ObjectHandler “的错误。

请作者指导。谢谢!

Aug 25, 2012 at 4:17 PM
Edited Aug 25, 2012 at 4:18 PM

已经解决:首先使用DbEntry.net.setup.zip包来进行安装,然后在解决方案中创建实体类项目时选择DbEntryClassLibrary模板来创建就可以了。

May 8, 2013 at 10:01 AM
感谢各位大神啦。 原来是介个样子..
Jun 15, 2014 at 4:54 AM
4.1的src和安装包里的版本号不一致,如果加载src调试会出现很多奇怪的问题。之前我用的旧配置文件Leafing,项目里写的是Lephone,配置改对了后就出现这个ObjectHandler的错误。把dll换回gac的就好了。