要做的系统采用C/S框架,数据库只能采用Access。访问Access采用oledb的形式,使用Entity framework必须要使用一个开源的provider,但是这个provider坑比较多,担心快速开发过程中遇到未知风险,不敢采用。求各位大佬推荐能访问Access数据库的轻量级框架。资金有限,只要免费的

解决方案 »

  1.   

    微软在大概15年前淘汰了 Jet 引擎,用 SQL Server Compact Edition 取代了它。仅仅在 Access 中还使用 Jet 而已。学习桌面嵌入式数据库开发,可以从这里下载安装包:https://archive.codeplex.com/?p=sqlcetoolbox
      

  2.   

    就用ado.net吧,资金有限,技术有限。
      

  3.   

    别用access了,轻量级数据库建议用sqlite3,数据库无需安装,sqilte DLL等支持文件+DB文件拷过去就能用了,你还能用sqilte的EF驱动,还能用linq访问sqlite,
    具体使用百度c# sqilite ef一大堆,例如
    http://www.cnblogs.com/Gyoung/p/4023275.html支持DBFirst或CodeFirst先安装sqlite3 for visual stdio 2015,然后nuget搜索装system.data.sqlite,顺带会装system.data.sqlite.core,system.data.sqlite.ef,system.data.sqlite.linq,
    app.config里改成  <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        <providers>
          <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
          <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
      <connectionStrings>
      </connectionStrings>
      <system.data>
        <DbProviderFactories>
          <remove invariant="System.Data.SQLite.EF6" />
          <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
          <remove invariant="System.Data.SQLite" />
          <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
        </DbProviderFactories>
      </system.data>
      

  4.   

    EF linq 访问:using (LocalEntities localEntity = new LocalEntities())
    {
     var q = from d in localEntity.XXXXX
                                                  orderby d.FlowNo descending
                                                  group d by d.InterAddress into g
                                                  select new
                                                  {
                                                      interAddress = g.Key,
                                                      planQtySum = g.Sum(p => p.PlanQty),
                                                      qtySum = g.Sum(p => p.Qty),
                                                      isPacked = g.Max(p => p.IsPacked),
                                                      state = g.Max(p => p.State),
                                                      flowNo = g.Max(p => p.FlowNo),
                                                      isUpdated = g.Max(p => p.IsUpdated)
                                                  };
    }
    直接SQL访问: lock (writeDatabaseLock_Local)
                                        {
    using (LocalEntities localEntity = new LocalEntities())
    {
                                            var t = localEntity.Database.BeginTransaction();
                                            try
                                            {
                                                localEntity.Database.ExecuteSqlCommand(
                                                    "UPDATE DownloadSortingData set XXX=? "
                                                    + "where YYY=?",
                                                    A,B;                                            localEntity.Database.ExecuteSqlCommand("insert into ZZZ"
                                                    + "(字段1,字段2...) "
                                                    + "values "
                                                    + "(?,?...) ",
                                                    AA,BB...);...
                                                t.Commit();
                                            }
                                            catch
                                            {
                                                t.Rollback();                                            throw;
                                            }
             }
    }