I’m not getting to import a namespace that I created

Asked

Viewed 43 times

0

Goodnight,

I created a namespace called: Enums inside Models, when I try to import within a class the Enums, I’m not getting through...

I’m with using Entity FrameWork with Asp.Net core MVC

Folder structure

inserir a descrição da imagem aqui

Enum: Salesstatus

namespace SalesWebMVC.Models.Enums
{
    public enum SaleStatus : int
    {
        Pending = 0,
        Billed = 1,
        Canceled = 2
    }
}

Model: Salesrecord

using SalesWebMVC.Models. // Não aparece o Enums aqui
{
    public class SalesRecord
    {
        public SalesStatus MyProperty { get; set; }
    }
}

1 answer

0

What you’re trying to do doesn’t make any sense... it’s not for that purpose that the using exists... For you to have the Enums namespace reference in your second class, you need to make the correct statement.

using SalesWebMVC.Models.Enums;

namespace SalesWebMVC.Models //ou o namespace correto ao qual sua classe pertence
{
    public class SalesRecord
    {
        public SalesStatus MyProperty { get; set; }
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.