Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

There is no implicit reference conversion from 'FileCabinetCA.Models.Repository.UserTypesRepository' to 'FileCabinetCA.Models.Repository.IUserTypesRepository' FileCabinetCA..NETCoreApp,Version=v1.0

$
0
0

hi  i am getting this errror any one help me please 

public void ConfigureServices(IServiceCollection services)
{

// Add framework services.
services.AddMvc();


var connection = Configuration["Data:FileCabinetConnectionString"];

services.AddEntityFramework().
AddDbContext<trmuekj8znorulypContext>(options
=> options.UseSqlServer(connection));

services.AddScoped<IUserTypesRepository, UserTypesRepository>();

}

Severity Code Description Project File Line Source Suppression State
Error CS0311 The type 'FileCabinetCA.Models.Repository.UserTypesRepository' cannot be used as type parameter 'TImplementation' in the generic type or method 'ServiceCollectionExtensions.AddScoped<TService, TImplementation>(IServiceCollection)'. There is no implicit reference conversion from 'FileCabinetCA.Models.Repository.UserTypesRepository' to 'FileCabinetCA.Models.Repository.IUserTypesRepository'. FileCabinetCA..NETCoreApp,Version=v1.0 D:\Phase2\FileCabinetCA\src\FileCabinetCA\Startup.cs 45 IntelliSense Active

 public class UserTypesRepository
    {
        private trmuekj8znorulypContext _context;

        public UserTypesRepository(trmuekj8znorulypContext context)
        {
            _context = context;
        }

        //CRUD Model

        public bool AddUserTypes()
        {
            // Need to Implement Code
            return true;
        }

        public IEnumerable<usertypes> GetAllUserTypes()
        {

            return _context.usertypes.ToList();
            // _context.usertypes.Include(t=>t.Stops).OrderBy(t=>t.Name).ToList();
            //_context.usertypes.ToList(t =t.Name).ToList();
        }

        public usertypes GetUserTypebyID(string _id)
        {
            return _context.usertypes.SingleOrDefault(u=>u.UserTypeID == _id);          
        }

        public bool UpdateUserTypebyId(string _id)
        {
            // Need to Implement Code
            return true;
        }


    }

  public interface IUserTypesRepository
    {
        bool AddUserTypes();
        IEnumerable<usertypes> GetAllUserTypes();
        usertypes GetUserTypebyID(string _id);
        bool UpdateUserTypebyId(string _id);
    }


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>