DbEntry4.1连接Sqlite问题

Topics: Developer Forum
Oct 12, 2012 at 9:34 AM

异常信息:“Lephone.Data.Definition.DbObjectModelBase`2”的类型初始值设定项引发异常。

使用DbEntry4.1连接sqlite,添加对象时报错,库和表已经建好,

app.config:

<configSections>
    <section name="Lephone.Settings"
      type="Lephone.Core.Setting.NameValueSectionHandler, Lephone.Core" />
    </configSections>

  <Lephone.Settings>
    <add key="DefaultContext" value="Development" />
    <add key="Development.AutoCreateTable" value="true" />
    <add key="Development.DataBase" value="@SQLite : @f:\dbfile\test.db" />
    <add key="Development.DbProviderFactory" value="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
  </Lephone.Settings>

code:

 public class Student:DbObjectModel<Student>
    {
        public String StuName { get; set; }

        public int Age { get; set; }
    }

  var stu = new Student { StuName = "jerry", Age = 21 };
   stu.Save();

 

sql:

create table Student
(
    Id Integer primary key,    
    StuName varchar(20),    
    Age int
)

 

Coordinator
Oct 12, 2012 at 4:52 PM

.Net 的异常,有些时候会有 InnerException,并且,InnerException 也有可能有 InnerException,只有最内层的异常,才是真实触发错误的异常。