Sunday, 1 May 2022

asp.net core

 https://stackoverflow.com/questions/63595993/how-to-pass-multiple-parameters-to-stored-procedure-on-net-core-3-1

asp.net core sp imp


https://ayende.com/blog/3955/repository-is-the-new-singleton;


if pass parameter value null pass like this

 var parameters = new List<SqlParameter>();


            if (string.IsNullOrEmpty(payload.Code) == false)

                parameters.Add(new SqlParameter("@code", payload.Code));

            else

                parameters.Add(new SqlParameter("@code", DBNull.Value));



web api 2 to core:

System.Data.DbType to convert 

System.Data.SqlDbType asp.net core


Severity Code Description Project File Line Suppression State

Error CS0029 Cannot implicitly convert type 'System.Collections.Generic.List<WebApplication11.Models.Address>' to 'Microsoft.AspNetCore.Mvc.ActionResult<WebApplication11.Models.Address>' FMSApiCore D:\Logicon\Angular\FMSAsp.NetCoreAPI\WebApplication11\Controllers\AddressesController.cs 61 Active


where condition issues

mostly getting issue due to list return in this change.
  public async Task<ActionResult<IEnumerable<Address>>> GetAddress(long id)

model class as folde with IEnumerable imp this one



Error CS1061 'Task<IEnumerable>' does not contain a definition for 'Where' and no accessible extension method 'Where'


  IEnumerable <Member>  members= (IEnumerable<Member>)_memberRepository.GetMembers();
            var result=    members.Where(x => x.MemberType == memberType && x.IsActive == true).ToList();

No comments:

Post a Comment

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...