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

Owned Property Error In Add Migration #22886

Closed
MEnzio opened this issue Oct 5, 2020 · 3 comments
Closed

Owned Property Error In Add Migration #22886

MEnzio opened this issue Oct 5, 2020 · 3 comments

Comments

@MEnzio
Copy link

MEnzio commented Oct 5, 2020

hello there

i have a entity like this

 [Table(nameof(SiteSettings), Schema = "Admin")]
    public class SiteSettings : BaseModel
    {
        public SiteSettings()
        {
            UniqueId = Guid.NewGuid();

        }
        [Key]
        public override Guid UniqueId { get; set; }
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Code { get; set; }
        public SmtpConfig Smtp { get; set; }
        public bool EnableEmailConfirmation { get; set; }
        public bool EnablePhoneConfirmation { get; set; }
        public TimeSpan EmailConfirmationTokenProviderLifespan { get; set; }
        public TimeSpan PhoneConfirmationTokenProviderLifespan { get; set; }
        public int NotAllowedPreviouslyUsedPasswords { get; set; }
        public int ChangePasswordReminderDays { get; set; }
        public string EmailsBanList { get; set; }
        public string PasswordsBanList { get; set; }
        public string AttahmentFileRoot { get; set; }
        public bool HttpsEnabled { get; set; }
   
    }

and the SmtpConfig class is

[Owned]
    public class SmtpConfig
    {

        public string Server { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public int Port { get; set; }
        public string LocalDomain { get; set; }
        public bool UsePickupFolder { get; set; }
        public string PickupFolder { get; set; }
        public string FromName { get; set; }
        public string FromAddress { get; set; }
    }

when im try ing to add migrations i got navigation propert error

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Navigation property 'Smtp' on entity type 'SiteSettings' is not virtual. UseLazyLoadingProxies requires all entity types to be public, unsealed, have virtual navigation properties, and have a public or protected constructor.

@ajcvickers
Copy link
Member

Duplicate of #12462

@ajcvickers ajcvickers marked this as a duplicate of #12462 Oct 5, 2020
@MEnzio
Copy link
Author

MEnzio commented Oct 5, 2020

is there any way to disable lazy loading for a specific entity i didnt find any thing in this link

im using ef core 3.1.7

@ajcvickers
Copy link
Member

@MEnzio tracked by #10787

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
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

2 participants