I have the following code:
using Data;
using MyProject_API.Models.ViewModels;
using System.Linq;
using Utilities.Web.Authentication;
namespace MyProject_API.Services.EmailTemplates
{
/// <summary>
/// Defines the <see cref="EmailTemplatesSearch" />
/// </summary>
public class EmailTemplatesSearch
{
/// <summary>
/// Initializes a new instance of the <see cref="EmailTemplatesSearch"/> class.
/// </summary>
/// <param name="dataContext">The dataContext<see cref="DataContext"/></param>
/// <param name="user">The user<see cref="MyProjectIdentity"/></param>
public EmailTemplatesSearch(DataContext dataContext, MyProjectIdentity user)
{
_db = dataContext;
_user = user;
}
I've cleaned the code with help of CodeFormatter
and get the following code:
namespace MyProject_API.Services.EmailTemplates
{
using MyProject_API.Models.ViewModels;
using System.Linq;
using Utilities.Web.Authentication;
/// <summary>
/// Defines the <see cref="EmailTemplatesSearch" />
/// </summary>
public class EmailTemplatesSearch
{
/// <summary>
/// Initializes a new instance of the <see cref="EmailTemplatesSearch"/> class.
/// </summary>
/// <param name="dataContext">The dataContext<see cref="DataContext"/></param>
/// <param name="user">The user<see cref="MyProjectIdentity"/></param>
public EmailTemplatesSearch(DataContext dataContext, MyProjectIdentity user)
{
_db = dataContext;
_user = user;
}
As you can see, CodeFormatter
looses using Data;
. I've tried to add using Data;
to the list of usings, but the code can't be compiled, DataContext
which is in Data
namespace can't be found. I fixed the problem moving using Data;
outside from namespace, but it looks like a crutch. DataContext
is defined like a
namespace Data
{
public class DataContext
- Why
CodeFormatter
loosesusing Data;
? - Why
using Data;
doesn't work inside the namespace?
I've searched for similar questions: LINQ to SQL Designer Bug , Should 'using' directives be inside or outside the namespace? , etc., but i still don't understand how to solve my issues