نظرات مطالب
ساخت دیتابیس sqlite با EF6 Code First
سلام مجدد
من از دات نت Core استفاده نمی‌کنم.
من مطابق زیر عمل کردم ولی بازم همان خطا را می‌دهد.
 the underlying provider failed to open
نمیدونم چرا تگ  Connection-string  را نمیشناسه. 
دقیقا در پروژه شما اگر تگ  Connection-string  را برداریم با چنین خطایی روبرو می‌شویم.
من پروژه تستی خودم را اینجا آپلود کردم.
کد XML فایل پروژه
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <connectionStrings>
    <add name="constr" connectionString="data source=.\phonebook.sqlite;foreign keys=true" providerName="System.Data.SQLite" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <!--<providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>-->
    <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>
  <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>
</configuration>
کد xml فایل Package
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net45" />
  <package id="jQuery" version="1.10.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net45" developmentDependency="true" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="SQLite.CodeFirst" version="1.3.0.17" targetFramework="net45" />
  <package id="System.Data.SQLite" version="1.0.105.0" targetFramework="net45" />
  <package id="System.Data.SQLite.Core" version="1.0.105.0" targetFramework="net45" />
  <package id="System.Data.SQLite.EF6" version="1.0.105.0" targetFramework="net45" />
  <package id="System.Data.SQLite.Linq" version="1.0.105.0" targetFramework="net45" />
</packages>

مابقی همون کلاس‌ها و کد‌های مثال آزمایشی شماست.
من انتظار دارم در لحظه اول در نبود Database.sqlte آن را ایجاد کند. ( مانند مثال شما )

اشتراک‌ها
برنامه ریزی برای EF Core 6.0

JSON columns

  • Introduce common patterns for JSON support that can be implemented by any database provider.
  • JSON column support will be implemented for SQL Server and SQLite. (Note that the PostgreSQL and MySQL providers already support JSON columns.) 
برنامه ریزی برای EF Core 6.0
اشتراک‌ها
Visual Studio 2019 version 16.1.2 منتشر شد
Visual Studio 2019 version 16.1.2 منتشر شد
اشتراک‌ها
دوره کامل NET MAUI.

.NET MAUI Full Course : Cross Platform Development
.NET MAUI allows you to create multi-platform apps using one code base. That means you can develop for Android, iOS, macOS and of course Windows at the same time!
In this course I provide numerous examples on how to use all the tools MAUI provides. Check out the long table of contents below.  
 

دوره کامل NET MAUI.
نظرات مطالب
استفاده از اسمبلی‌های دات نت 2 در یک پروژه دات نت 4
جهت تکمیل بحث در مورد mixed-mode assemblies به این آدرس مراجعه کنید : (+)
به عبارتی اسمبلی‌هایی هستند که حاوی کدهای managed و unmanaged می‌باشند مانند اسمبلی ساخته شده برای SQLite که هم کدهای دات نتی دارند و هم کدهای اصل مرتبط با خود SQLite که با زبان C نوشته شده.
اشتراک‌ها
سری آموزشی #C برای تازه‌ کارها


C# for Beginners
Join Scott Hanselman and .NET Distinguished Engineer David Fowler as they teach us C# from the ground up! From Hello World to LINQ and more, Scott and David share C# lessons at a deep and leisurely pace. By the end you'll be ready to explore the Foundational C# Certification from FreeCodeCamp!

 

سری آموزشی #C برای تازه‌ کارها