English 中文(简体)
升级为6.NET,但在执行APIC 存储程序时却收到无例外错误
原标题:Upgraded to .NET 6.0 but receiving null exception error when executing stored procedure in API
  • 时间:2023-05-27 02:51:56
  •  标签:
  • c#
  • .net
  • api

I have upgraded my code from net core 2.2 to .net6.0, after upgrading the respective packages, I can be able to execute part of code, but when I try to execute the stored procedure in one of method, it gets failed with null exception. other methods are running fine for other SP executions. I have verified in DB by executing SP manually, it works fine. it is getting null exception error. Mostly the result from SP is not able to load into the model. Need help on this. your text private async Task<IEnumerable> MentorRepDetails(string userId) {your text var uId = new SqlParameter("@userId", userId);
using (var ctx = _generateDbContext.GenerateNetCoreContext(_configuration)) { DbSet s = ctx.Set();your text var data = await s.FromSqlRaw($"EXEC Supp @userId", uId).AsQueryable().ToListAsync(); return data; } }

公职人员

{
    [JsonProperty("UserId")]

   public string UserId { get; set; }

    [JsonIgnore]

    [JsonProperty("MenteeUserId")]

    public string MenteeUserId { get; set; }

    [JsonProperty("FirstName")]
    public string FirstName { get; set; }
    [JsonProperty("LastName")]
    public string LastName { get; set; }
    [JsonProperty("code")]
    public string Code { get; set; }
    [JsonProperty("Status")]
    public string Status { get; set; }
    [JsonProperty("ACode")]
    public string ACode { get; set; }
    [JsonProperty("PRole")]
    public string PRole { get; set; }
     [JsonIgnore]
    public RepInfo RepInfoData { get; set; }
     [JsonProperty("AffRepTeamDetails")]`your text`
    public ICollection<TeamInfo> AffRepTeamDetails { get; set; }
     public MentorRep()
    {
        AffRepTeamDetails = new HashSet<TeamInfo>();
    }
 }

模型Builder.Entity(v =>);

        {
            v.HasKey(p => new { p.UserId, p.MenteeUserId });
            v.HasOne(e => e.RepInfoData)
                .WithMany(e => e.AffiliatedRepDetails);
        });

我希望,所储存的程序结果无法装入模型,在较早的2. 核心净额中,该模型的运行是罚款的。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签