1

We have application which should work on both sql server and oracle.we have used Sql functions in all over application. now we are migrating to oracle. below are Sql Functions that we used.

SqlFunctions.StringConvert()
SqlFunctions.DateAdd()
SqlFunctions.Replicate()
SqlFunctions.DateDiff() 

Now we need alternative for above functions which will work with oracle. after google a lot the solution that i found is - use of AsEnumerable() or ToList() fetch records in memory then do the conversion but this methods are not good for performance as we have huge records in table. any other alternative ?

Linq Query ex -

var _IBTFile = from c in DataContext.DB0820205
               join s in DataContext.DB0820005 on c.ReconcileId equals s.PkId
               join a in DataContext.DB0820005 on c.ReconcileWithId equals a.PkId

               where s.status != upoaded && s.ReconciliationOnDate == EntryDate  && s.InstrumentNo != 0
               && c.ReconProcessType == ReconProcessType
               select new IBTFileUploadVm
               {
                   PkId = s.PkId,
                   InstrumentNo =System.Data.Entity.SqlServer.SqlFunctions.StringConvert( s.InstrumentNo),
                   LcyAmount = s.FcyAmount,
                   ReconDate = s.ReconciliationOnDate,
                   ReconType = 0,
                   DDDetailsVm = new DB0820002Vm
                   {
                       PkId = a.PkId,
                       PrintedDDNumberString =System.Data.Entity.SqlServer.SqlFunctions.StringConvert( s.InstrumentNo),
                       RemittanceAmount = a.FcyAmount,
                       BranchName = "",

                   },
                   PostDate = a.PostDate,
                   ValueDate = s.ReconciliationOnDate,
                   db0820205id = c.PkId,
               };
return _IBTFile;
imsome1
  • 1,182
  • 4
  • 22
  • 37
deepak neo
  • 61
  • 1
  • 8
  • for SqlFunctions.StringConvert() i found alternative :) in EF 6.1+ Supports .tostring() https://stackoverflow.com/a/22479240/4255229 – deepak neo Sep 19 '17 at 11:50

1 Answers1

0
System.Data.Entity.DbFunctions  this is the alternative for above functions except replicate() and StringConvert() function
deepak neo
  • 61
  • 1
  • 8