<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Is EntityFramework Code First Supported in Fabric SQL Database? in SQL database</title>
    <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4833788#M461</link>
    <description>&lt;P&gt;Is there some kind of firewall setting that needs to be toggled? The only way I can connect to a Fabric SQL database through the write/update endpoint "[myServerName].database.fabric.microsoft.com,1433" is to use the Open In -&amp;gt; SQL Server Management Studio menu option inside the Fabric Web Portal.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Attempts to connect via Entity Framework.Core using C# fail as well. It feels like there is a setting my tenant admin needs to clear for me.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Sep 2025 22:12:58 GMT</pubDate>
    <dc:creator>Shawn_Eary</dc:creator>
    <dc:date>2025-09-23T22:12:58Z</dc:date>
    <item>
      <title>Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4828876#M448</link>
      <description>&lt;P&gt;I have an empty SQL database in Fabric. Grok wrote a few POCOs and created a DBContext for me. Grok then told me to do this:&lt;BR /&gt;&lt;STRONG&gt;dotnet ef migrations add InitialCreate&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;That run okay with this warning:&lt;BR /&gt;&lt;STRONG&gt;PS C:\Users\seary\source\repos\UITS-seary-language-helper&amp;gt; dotnet ef migrations add InitialCreate&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Build started...&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Build succeeded.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;The Entity Framework tools version '9.0.6' is older than that of the runtime '9.0.9'&lt;/FONT&gt;. Update the tools for the latest features and bug fixes. See &lt;A href="https://aka.ms/AAc1fbw" target="_blank" rel="noopener"&gt;https://aka.ms/AAc1fbw&lt;/A&gt; for more information.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Done. To undo this action, use 'ef migrations remove'&lt;/STRONG&gt;&lt;BR /&gt;but I don't see the tables anywhere in the DB.&lt;BR /&gt;&lt;BR /&gt;Then Grok told me to do this:&lt;BR /&gt;&lt;STRONG&gt;dotnet ef database update&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Which eventually terminated with the error:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;PROCEDURE 'sp_getapplock' is not supported.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Is it possible to do EntityFramework Code First developement in a Fabric SQL Database? If not, when will that be supported?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 20:27:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4828876#M448</guid>
      <dc:creator>Shawn_Eary</dc:creator>
      <dc:date>2025-09-17T20:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4829698#M449</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="146322" data-lia-user-login="Shawn_Eary" class="lia-mention lia-mention-user"&gt;Shawn_Eary&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EF Core can be used to connect to Fabric SQL DB and carry out basic CRUD operations. However, EF Core Migrations that depend on unsupported system procedures are not available. As an alternative, you can manually create SQL scripts from your EF model and execute them in Fabric, though this disrupts the Code First automation process.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;I&gt;&lt;/I&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 12:06:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4829698#M449</guid>
      <dc:creator>v-sathmakuri</dc:creator>
      <dc:date>2025-09-18T12:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4830890#M453</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="146322" data-lia-user-login="Shawn_Eary" class="lia-mention lia-mention-user"&gt;Shawn_Eary&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EF Core migrations do work with SQL database in Fabric, there's a mistake in the previous reply.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears you may have grabbed the connection information for the read-only SQL analytics endpoint instead of the SQL database in Fabric - an understandable point of confusion that's come up a few times.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your connection string for SQL db in Fabric would look similar to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Data Source=&lt;STRONG&gt;x6eps4xrq2xudenlfv6naeo3i4-fewuicewklvrnklvejkll&lt;/STRONG&gt;.&lt;STRONG&gt;database.fabric.microsoft.com&lt;/STRONG&gt;,1433;Initial Catalog=&lt;STRONG&gt;ContosoUniversity-a11e1987-145c-4fb5-8934-e6136cbf6128&lt;/STRONG&gt;;Multiple Active Result Sets=False;Connect Timeout=30;Encrypt=True;Trust Server Certificate=False;Authentication=Active Directory Interactive&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I highlighted 2 parts that help discern if you're connecting to the actual SQL database:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1. the server name ends with ".database.fabric.microsoft.com"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2. the database name has a guid appended on the end&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If your connection string is to the read-only SQL analytics endpoint, the server name ends with ".datawarehouse.fabric.microsoft.com".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please let me know if this gets you rolling again, or if you're still unable to apply the EF migrations to SQL db in Fabric. We can potentially hop on a call to troubleshoot.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Sep 2025 17:36:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4830890#M453</guid>
      <dc:creator>drew-sk</dc:creator>
      <dc:date>2025-09-19T17:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4833788#M461</link>
      <description>&lt;P&gt;Is there some kind of firewall setting that needs to be toggled? The only way I can connect to a Fabric SQL database through the write/update endpoint "[myServerName].database.fabric.microsoft.com,1433" is to use the Open In -&amp;gt; SQL Server Management Studio menu option inside the Fabric Web Portal.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Attempts to connect via Entity Framework.Core using C# fail as well. It feels like there is a setting my tenant admin needs to clear for me.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2025 22:12:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4833788#M461</guid>
      <dc:creator>Shawn_Eary</dc:creator>
      <dc:date>2025-09-23T22:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4833810#M462</link>
      <description>&lt;P&gt;Hmm, that is odd. There's no firewall settings to configure on the Fabric side. What other connection options are failing for you?&lt;/P&gt;&lt;P&gt;I wonder if these apps are attempting to connect to "&amp;lt;default&amp;gt;" or "master", instead of the specific database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can try out a plain C# console app and see if that gives us any insights into the connectivity -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ConnectionTester.csproj&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;Project Sdk="Microsoft.NET.Sdk"&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;OutputType&amp;gt;Exe&amp;lt;/OutputType&amp;gt;
    &amp;lt;TargetFramework&amp;gt;net8.0&amp;lt;/TargetFramework&amp;gt;
    &amp;lt;ImplicitUsings&amp;gt;enable&amp;lt;/ImplicitUsings&amp;gt;
    &amp;lt;Nullable&amp;gt;enable&amp;lt;/Nullable&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.1" /&amp;gt;
    &amp;lt;PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" /&amp;gt;
    &amp;lt;PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;None Include="appsettings.json"&amp;gt;
      &amp;lt;CopyToOutputDirectory&amp;gt;Always&amp;lt;/CopyToOutputDirectory&amp;gt;
    &amp;lt;/None&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;appsettings.json&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=yourcxninfo.database.fabric.microsoft.com,1433;Initial Catalog=AdventureWorks-20ba15a4-b4f9-4d46-ad10-ddd9d0b7a6ea;Multiple Active Result Sets=False;Connect Timeout=30;Encrypt=True;Trust Server Certificate=False;Authentication=Active Directory Interactive"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program.cs&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using System.Diagnostics;

namespace ConnectionTester;

class Program
{
    private static IConfiguration? _configuration;
    
    static async Task Main(string[] args)
    {
        // Build configuration from appsettings.json
        _configuration = new ConfigurationBuilder()
            .SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
            .Build();
        
        Console.WriteLine("SQL Database Connection Tester");
        Console.WriteLine("==============================");
        Console.WriteLine();
        
        var connectionString = _configuration?.GetConnectionString("DefaultConnection");
        if (string.IsNullOrEmpty(connectionString))
        {
            Console.WriteLine("✗ Error: No connection string found in appsettings.json");
            return;
        }
        
        await TestDatabaseConnectionAsync(connectionString);
        
        Console.WriteLine();
        Console.WriteLine("Press any key to exit...");
        Console.ReadKey();
    }
    
    private static async Task TestDatabaseConnectionAsync(string connectionString)
    {
        var stopwatch = Stopwatch.StartNew();
        
        try
        {
            Console.WriteLine("Attempting to connect to the database...");
            
            using var connection = new SqlConnection(connectionString);
            
            // Test opening the connection
            await connection.OpenAsync();
            Console.WriteLine("✓ Successfully connected to the database!");
            
            // Test executing a simple query
            Console.WriteLine("Testing query execution...");
            using var command = new SqlCommand("SELECT @@VERSION as ServerVersion, GETDATE() as CurrentTime", connection);
            using var reader = await command.ExecuteReaderAsync();
            
            if (await reader.ReadAsync())
            {
                Console.WriteLine("✓ Query execution successful!");
                Console.WriteLine($"  Current Server Time: {reader["CurrentTime"]}");
            }
            
            stopwatch.Stop();
            Console.WriteLine($"✓ Connection test completed successfully in {stopwatch.ElapsedMilliseconds}ms");
        }
        catch (SqlException sqlEx)
        {
            stopwatch.Stop();
            Console.WriteLine($"✗ SQL Server error occurred after {stopwatch.ElapsedMilliseconds}ms:");
            Console.WriteLine($"  Error Number: {sqlEx.Number}; Severity: {sqlEx.Class}; State: {sqlEx.State}; Message: {sqlEx.Message}");
        }
        catch (Exception ex)
        {
            stopwatch.Stop();
            Console.WriteLine($"✗ General error occurred after {stopwatch.ElapsedMilliseconds}ms:");
            Console.WriteLine($"  Type: {ex.GetType().Name}");
            Console.WriteLine($"  Message: {ex.Message}");
        }
    }
    
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2025 23:05:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4833810#M462</guid>
      <dc:creator>drew-sk</dc:creator>
      <dc:date>2025-09-23T23:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4834568#M470</link>
      <description>&lt;P&gt;This C# program works as expected for me. I'm still looking into my other issues.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 18:00:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4834568#M470</guid>
      <dc:creator>Shawn_Eary</dc:creator>
      <dc:date>2025-09-24T18:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is EntityFramework Code First Supported in Fabric SQL Database?</title>
      <link>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4834677#M472</link>
      <description>&lt;P&gt;Entity Framework is now working in a Fabric SQL Database for me. I have not created a new table yet, but I migrated an Azure SQL Server database over to Fabric and I am able to read from &lt;STRONG&gt;and&lt;/STRONG&gt; update it as expected using the&amp;nbsp;&lt;SPAN&gt;.&lt;STRONG&gt;database.fabric.microsoft.com&lt;/STRONG&gt;&lt;/SPAN&gt; endpoint.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We should consider this ticket closed unless I run into a problem later when creating a new table/POCO. Even if I have a problem, I have a way by which I can continue to use Entity Framework with Fabric SQL Database.&lt;BR /&gt;&lt;BR /&gt;Thanks Microsoft!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 22:04:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/SQL-database/Is-EntityFramework-Code-First-Supported-in-Fabric-SQL-Database/m-p/4834677#M472</guid>
      <dc:creator>Shawn_Eary</dc:creator>
      <dc:date>2025-09-24T22:04:15Z</dc:date>
    </item>
  </channel>
</rss>

