New answers tagged

1

Some quick remarks: GetBuilds does multiple things, so split that up into smaller methods that each do a specific job. And then check which of those methods causes the issues. Use Dapper instead of ADO.NET. (Why are you even mixing ADO.NET and Entity Framework?) Are the DB properties you do INNER JOINs on properly indexed? Don't add "Class" to the name of ...


2

Review Your design uses a dedicated repository and service for each entity. This might look like a great idea at first, but you'll soon realise the drawbacks of this design. Having a service as a glorified wrapper of a repository doesn't add much value to the service. I would question whether a service should yield IQueryable. I find a service to be in ...


1

Interesting problem, hard to solve with so Little information but perhaps test if you're data management is not as efficient as you hope or you might even have a locking issue on the database where you're blocking yourself. Normally what I would do in a situation like this is the following. Have the webservice write the data in a staging table and return ...


3

Review The other answers already provide proper ways to refactor the design and split the method up into smaller methods. I would like to address some minor concerns I have with this method. The method name CompareHands suggests a comparison, which in C# has a built-in pattern IComparable<SuperCard> yielding an integer containing the comparison ...


-1

this is called Operators Precedence, you can work with this by placing "(" around your formulas. Say you plan to do (buy-Sell) * Sales Tax = Tax on Invoice leave away the brackets and it would execute like this buy - (Sell * Sales Tax) = BAD Tax on Invoice You can "google" Operators Precedence to see the operators precedence applied for a given ...


2

Review The calculator requires a very specific syntax and depends on whitespace delimiters. As a consumer it is really easy to make a mistake in using the calculator. I would expect a basic calculator to include parentheses parsing as well as the basic operators +-/*. You split the input in a series of string tokens List<string> equationList. String ...


1

(Missing) Specification You are lacking a clear specification (comments). The way you implemented it, you consider not exists and don't know whether it exists as one and the same. I would expect a method called DirectoryExists to: return true when the directory exists return false when it does not exist throw an exception when unabe to determine existence ...


5

var result = new List<ScrapCategory>(); ... if (!result.Contains(parent)) There's one performance problem. Use a data structure which gives fast Contains checks: typically HashSet<>. var parent = categories.Where(x => x.Id == parentId)?.First(); There's another one. I assume that IDs are unique, in which ...


3

A possibility is to store the parents as we go so we don't need to keep searching though the input array. We can use a dictionary to look up the parents by id. If we can guarantee that the ancestors for a category all appear in the array before the category then we can do this in one pass. Reading through the array we add each category to the dictionary, ...


5

I have a few ideas... CheckFileSize & CheckFileType should be implemented either via action-filters or Model validation attributes the exceptions they throw are too generic and don't tell me which files where invalid Repository.GetAll().Where(x => x.InspectionTypeId == 1) getting everything and then filtering it is very inefficient. You should remove ...


Top 50 recent answers are included