C
C#3y ago
M B V R K

The type or namespace name 'IArchivable' could not be found

Hi, I'm working on an ASP.net core 6 project with EF Core using CQRS and Clean Architecture. The problem is : I have the class captured in the provided screenshot, I just commited a change in one of the project apps, and from another computer I pulled the last changes, but the JetBrains Rider show the following errors when I try to build the entire solution.
ArchivableEntityExtensions.cs(7, 122): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?) ArchivableEntityExtensions.cs(17, 119): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?) ArchivableEntityExtensions.cs(22, 124): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?) ArchivableEntityExtensions.cs(12, 127): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?) ArchivableEntityExtensions.cs(28, 128): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?) ArchivableEntityExtensions.cs(33, 133): [CS0246] The type or namespace name 'IArchivable' could not be found (are you missing a using directive or an assembly reference?)
Please, I hope if anyone has any idea about how to fix this issue, and thanks in advance
11 Replies
M B V R K
M B V R KOP3y ago
The screenshot of errors
M B V R K
M B V R KOP3y ago
V0FBU1VM
V0FBU1VM3y ago
Could you show the entire content in that fil? Including the namespace.
M B V R K
M B V R KOP3y ago
using MBSM.Core.Interfaces;

namespace MBSM.DAL.Extensions;

public static class ArchivableEntityExtensions
{
public static IQueryable<TEntity> OnlyNonArchivedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == false || x.IsArchived == null );
}

public static IQueryable<TEntity> OnlyNonArchivedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == false || x.IsArchived == null );
}

public static IQueryable<TEntity> OnlyArchivedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == true );
}

public static IQueryable<TEntity> OnlyArchivedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == true );
}


public static IQueryable<TEntity> OnlyArchivedOrDeletedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable, IAuditable
{
return dbSet.Where( x => x.IsArchived == true || x.IsDeleted == true );
}

public static IQueryable<TEntity> OnlyArchivedOrDeletedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable, IAuditable
{
return dbSet.Where( x => x.IsArchived == true || x.IsDeleted == true );
}
}
using MBSM.Core.Interfaces;

namespace MBSM.DAL.Extensions;

public static class ArchivableEntityExtensions
{
public static IQueryable<TEntity> OnlyNonArchivedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == false || x.IsArchived == null );
}

public static IQueryable<TEntity> OnlyNonArchivedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == false || x.IsArchived == null );
}

public static IQueryable<TEntity> OnlyArchivedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == true );
}

public static IQueryable<TEntity> OnlyArchivedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable
{
return dbSet.Where( x => x.IsArchived == true );
}


public static IQueryable<TEntity> OnlyArchivedOrDeletedEntities<TEntity>(this DbSet<TEntity> dbSet) where TEntity : class, IArchivable, IAuditable
{
return dbSet.Where( x => x.IsArchived == true || x.IsDeleted == true );
}

public static IQueryable<TEntity> OnlyArchivedOrDeletedEntities<TEntity>(this IQueryable<TEntity> dbSet) where TEntity : class, IArchivable, IAuditable
{
return dbSet.Where( x => x.IsArchived == true || x.IsDeleted == true );
}
}
I actually have a global usings file
M B V R K
M B V R KOP3y ago
M B V R K
M B V R KOP3y ago
and it contains the following usings
global using System.Linq;
global using System.Threading.Tasks;
global using MBSM.Core.Entities;
global using MBSM.DAL.Ef_Core_DbContext;
global using Microsoft.EntityFrameworkCore;
global using MBSM.DAL.Abstraction;
global using MBSM.DAL.Entity_Queries;
global using MBSM.DAL.Repositories;
global using System.Linq;
global using System.Threading.Tasks;
global using MBSM.Core.Entities;
global using MBSM.DAL.Ef_Core_DbContext;
global using Microsoft.EntityFrameworkCore;
global using MBSM.DAL.Abstraction;
global using MBSM.DAL.Entity_Queries;
global using MBSM.DAL.Repositories;
V0FBU1VM
V0FBU1VM3y ago
Could you show IArchivable?
M B V R K
M B V R KOP3y ago
using System;

namespace MBSM.Core.Interfaces
{
public interface IArchivable
{
bool? IsArchived { get; set; }
string ArchivedBy { get; set; }
DateTime? ArchivedOn { get; set; }
}
}
using System;

namespace MBSM.Core.Interfaces
{
public interface IArchivable
{
bool? IsArchived { get; set; }
string ArchivedBy { get; set; }
DateTime? ArchivedOn { get; set; }
}
}
Matt Warren
Matt Warren3y ago
You don't have MBSM.Core.Interfaces in your global.cs file
V0FBU1VM
V0FBU1VM3y ago
Yes but he does have it inside the file which is using it. That's the weird thing.
M B V R K
M B V R KOP3y ago
wait wait wait, what the actua f...k happened, idk how I forgot it but why everything works fine in another computer omg I added it to global usings
global using MBSM.Core.Interfaces;
global using MBSM.Core.Interfaces;
but still getting the same errror holly crap all the problem is I didn't built the MBSM.Core project
Want results from more Discord servers?
Add your server