Home > Enterprise >  "MySqlParamater.cs not found" in visual studio
"MySqlParamater.cs not found" in visual studio

Time:07-23

i'm getting this weird error i've not seen before in Visual Studio.

I'm trying to call a stored procedure in MySql using Pomelo EntityFramework and in doing so I'm having to create a MySqlParameter.

This is the class that's creating the parameter:

using ITSystemAPI.DataAccess.DbContexts;
using ITSystemAPI.DataAccess.IRepositories;
using ITSystemAPI.DataAccess.IRepositories.MySqlStoredProc;
using ITSystemAPI.Domain.Target;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using MySqlConnector;

namespace ITSystemAPI.DataAccess.Repositories.MySql.Tickets
{
    public class ClientTicketInformationRepository : IAsyncTicketsByClientIdRepo
    {
        private readonly MySqlUnitOfWork _dbContext;
        public ClientTicketInformationRepository(MySqlUnitOfWork dbContext)
        {
            _dbContext = dbContext;
        }

        public async Task<List<TicketInfoLocal>> GetTickets(Guid clientId)
        {
            var param = new MySqlParameter
            {
                ParameterName = "@clientId",
                Value = clientId
            };
            
            var result = await _dbContext.ticket_info.FromSqlRaw(@"exec GetTicketInformation", param).ToListAsync();
            return result;
        }
    }
}

And when it gets to the point of creating the Parameter, it gives me this error: enter image description here

Now the weird this is when I F12 on the MySqlParameter, if goes to the .cs file it says it cannot find

Any help would be appreciated

CodePudding user response:

You can stop Visual Studio from trying to load code from outside your project by going to Tools > Options > Debugging > General, and checking "Enable Just My Code".

Alternatively, the MySqlConnector package is built with Source Link, so it may also work to check "Enable Source Link support" instead.

  • Related