Ali Ylmaz

Ali Ylmaz

  • NA
  • 129
  • 11.9k

Entity Framework SQL_Latin1_General_CP1_CS_AS and Turkish_CI_AS in the

Apr 27 2022 6:45 PM

Hi,

I am getting this error in Entity Framework inner join. How can I resolve this error. without touching the database.

I get error

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CS_AS" and "Turkish_CI_AS" in the equal to operation.

 I need to add below code.

var result = from cartItem in contex.CartItem
                           join article in contex.Article
 
                           on cartItem.Articel_Oid equals article.Articel_Oid
                           join saleSeason in contex.B2B_SaleSeasonDefinition
 
                           on new { SaleSeasonOid = cartItem.SaleSeason_Oid, SaleSeasonId = cartItem.SaleSeason_Id }
                           equals new { SaleSeasonOid = saleSeason.Oid, SaleSeasonId = saleSeason.Id }
 
                           join customer in contex.CurrentCustomer
                           on cartItem.Customer_Code equals customer.Code
 
 
                           where cartItem.Customer_Code == Customer
                           group cartItem by new { article.Articel_Oid, article.Articel_Code, article.Model_ArticelName, cartItem.SaleSeason_Oid, cartItem.SaleSeason_Id, cartItem.UnitPrice, customer.ShippingCost, customer.FreightVAT, cartItem.SubUnitPrice }
 
                           into cart
                           select new ArticleInCart
                           {
                               Articel_Oid = cart.Key.Articel_Oid,
                               Article_Code = cart.Key.Articel_Code,
                               Articel_Name = cart.Key.Model_ArticelName,
                               SumQuantity = cart.Sum(x => x.Quantity),
                               UnitPrice = cart.Key.UnitPrice,//cart.Sum(x => x.Price) / cart.Sum(x => x.Quantity),
                               Price = cart.Sum(x => x.SubTotal),
                               SaleSeason = cart.Key.SaleSeason_Oid,
                               SaleSeason_Id = cart.Key.SaleSeason_Id,
                               Kargo = cart.Key.ShippingCost,
                               KargoVergi = cart.Key.FreightVAT,
                               SubUnitPrice = cart.Key.SubUnitPrice,
                              
                                
 
                           };
 
              return result.OrderBy(x => x.Article_Code).ToList();

 

 


Answers (1)