Click here to Skip to main content
15,172,297 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get Millions of files from folder and bulk insert in database Pin
Richard MacCutchan16-Oct-21 5:00
mveRichard MacCutchan16-Oct-21 5:00 
GeneralRe: How to get Millions of files from folder and bulk insert in database Pin
Eddy Vluggen16-Oct-21 5:18
professionalEddy Vluggen16-Oct-21 5:18 
GeneralRe: How to get Millions of files from folder and bulk insert in database Pin
Ankur B. Patel16-Oct-21 5:59
MemberAnkur B. Patel16-Oct-21 5:59 
GeneralRe: How to get Millions of files from folder and bulk insert in database Pin
Gerry Schmitz16-Oct-21 12:04
mveGerry Schmitz16-Oct-21 12:04 
AnswerRe: How to get Millions of files from folder and bulk insert in database Pin
OriginalGriff16-Oct-21 7:43
mveOriginalGriff16-Oct-21 7:43 
AnswerRe: How to get Millions of files from folder and bulk insert in database Pin
Michael Sydney Balloni16-Oct-21 18:36
mvaMichael Sydney Balloni16-Oct-21 18:36 
AnswerRe: How to get Millions of files from folder and bulk insert in database Pin
jschell24-Oct-21 7:50
Memberjschell24-Oct-21 7:50 
QuestionPredicateBuilder Question Pin
Kevin Marois15-Oct-21 6:24
professionalKevin Marois15-Oct-21 6:24 
I have this Linq-To-Sql query. I'm now going to introduce conditions that match the parameters:
public List<VendorsByProjectAndJobReportEntity> GetVendorsByProjectAndJobReportData(int appCompanyId,
                                                                                    List<int> projectIds, 
                                                                                    List<int> jobIds, 
                                                                                    List<PurchaseOrderType> purchaseOrderTypes)
{
    using (var dc = GetDataContext())
    {
        var results = (from j in dc.Jobs
                        join ac in dc.AppCompanies on j.AppCompanyId equals ac.Id
                        join p in dc.Projects on j.ProjectId equals p.Id
                        join poh in dc.PurchaseOrderHeaders on j.Id equals poh.JobId
                        join cl in dc.CompanyLocations on poh.VendorId equals cl.Id
                        where ac.Id == appCompanyId &&
                                !j.DeletedDT.HasValue &&
                                !p.DeletedDT.HasValue &&
                                (poh.POStatus != (int)PurchaseOrderPOState.Cancelled &&
                                poh.POStatus != (int)PurchaseOrderPOState.Draft)
                        select new VendorsByProjectAndJobReportEntity
                        {
                            ProjectId = p.Id,
                            ProjectInfo = $"{p.ProjectNumber.ToString()} - {p.ProjectName}",
                            JobId = j.Id,
                            JobInfo = $"{j.JobNumber.ToString()} - {j.Phase}",
                            VendorId = cl.Id,
                            VendorName = cl.Location,
                            PurchaseOrderType = (PurchaseOrderType)poh.PurchaseOrderType,
                            PurchaseOrderTotal = poh.Total,
                            ReportTitle = $"{ac.CompanyName} Vendors by Project and Job"
                        }).ToList();

        return results.OrderBy(x => x.ProjectInfo)
                        .ThenBy(x => x.JobInfo)
                        .ThenBy(x => x.PurchaseOrderTypeDesc)
                        .ThenBy(x => x.VendorName).ToList();
    }
}
I want to replace the Where clause with a PredicateBuilder, so I start out like this:
var predicate = PredicateBuilder.New<VendorsByProjectAndJobReportEntity>();
predicate = predicate.And(x => !x.DeletedDT.HasValue);
First, I don't want either Project or Job records if they're deleted. Which record is 'x' referring to in the PredicateBuilder?

The only way I can see making this work is to add both a ProjectDeletedByDT and JobDeletedBtDT to the entity and assigning both of those dates to it.

Anyone have a better approach?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: PredicateBuilder Question Pin
Eddy Vluggen15-Oct-21 15:44
professionalEddy Vluggen15-Oct-21 15:44 
QuestionTask.WhenAll ConfigureAwait Question Pin
Kevin Marois14-Oct-21 13:57
professionalKevin Marois14-Oct-21 13:57 
AnswerRe: Task.WhenAll ConfigureAwait Question Pin
Richard Deeming15-Oct-21 0:15
mveRichard Deeming15-Oct-21 0:15 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Kevin Marois15-Oct-21 5:53
professionalKevin Marois15-Oct-21 5:53 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Richard Deeming15-Oct-21 6:59
mveRichard Deeming15-Oct-21 6:59 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Kevin Marois15-Oct-21 7:29
professionalKevin Marois15-Oct-21 7:29 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Kevin Marois15-Oct-21 9:08
professionalKevin Marois15-Oct-21 9:08 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Richard Deeming17-Oct-21 22:58
mveRichard Deeming17-Oct-21 22:58 
GeneralRe: Task.WhenAll ConfigureAwait Question Pin
Kevin Marois18-Oct-21 5:01
professionalKevin Marois18-Oct-21 5:01 
QuestionCodility fails to compile even though it compiles in VS code? Pin
Cliff ludo13-Oct-21 7:41
MemberCliff ludo13-Oct-21 7:41 
AnswerRe: Codility fails to compile even though it compiles in VS code? Pin
BillWoodruff13-Oct-21 18:11
mveBillWoodruff13-Oct-21 18:11 
Generalpass array to function Pin
Cliff ludo13-Oct-21 0:04
MemberCliff ludo13-Oct-21 0:04 
GeneralRe: pass array to function Pin
Richard Deeming13-Oct-21 0:25
mveRichard Deeming13-Oct-21 0:25 
GeneralRe: pass array to function Pin
Cliff ludo13-Oct-21 0:32
MemberCliff ludo13-Oct-21 0:32 
QuestionCreating An Async Method Pin
Kevin Marois7-Oct-21 12:02
professionalKevin Marois7-Oct-21 12:02 
AnswerRe: Creating An Async Method Pin
Richard Deeming7-Oct-21 22:41
mveRichard Deeming7-Oct-21 22:41 
GeneralRe: Creating An Async Method Pin
Kevin Marois8-Oct-21 7:00
professionalKevin Marois8-Oct-21 7:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.