Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbcontext optimize command omits certain characters from namespaces #30045

Closed
chriscameron-vertexinc opened this issue Jan 12, 2023 · 2 comments

Comments

@chriscameron-vertexinc
Copy link

EF Core version: 7.0.1
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: .NET 7.0
Operating system: Windows 10
IDE: Visual Studio 2022 17.4.2

I am exploring the use of Compiled Models in my Entity Framework projects to reduce warmup time.

I'm running the command:
dotnet ef dbcontext optimize -o Model/Optimized -n 'My_Namespace' -c MyContext -v

And ending up with generated code in the namespace:
MyNamespace

// <auto-generated />
using System;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Metadata;

#pragma warning disable 219, 612, 618
#nullable enable

namespace MyNamespace
{

I thought it may have been an escaping issue, so I tried:
dotnet ef dbcontext optimize -o Model/Optimized -n 'My\_Namespace' -c MyContext -v

And still ended up with:
MyNamespace

The output from the command ends with the following, incorrect instruction:
Successfully generated a compiled model, to use it call 'options.UseModel(My\_Namespace.MyContextModel.Instance)'. Run this command again when the model is modified.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 12, 2023

I think this will be fixed in 7.0.3

@ajcvickers
Copy link
Member

Likely duplicate of #29450.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants