C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in parallel with the .NET platform

learn more… | top users | synonyms

3
votes
3answers
338 views

Design Pattern dilemma. Strategy seems wrong?

I would like some help/advice on a design pattern or similar I could use for my problem. I have some shared functionality in my code and I use the Strategy pattern at present. I have a base class ...
0
votes
1answer
145 views

How would I go about having an editable file to transform an object on a webpage?

I have some code that creates objects on a webpage by using draw on HTML5 canvas. In my aspx file I have functions like: function drawLine(x, y, w, h, width) { var canvas = document.getElementById(...
4
votes
4answers
4k views

Exceptions vs ErrorCodes when working with devices

Out team is at the cusp of a new project. One of the components at the boundary of the system is the component which interacts with a printer through an external COM component (referenced as a usual ...
3
votes
1answer
194 views

Are areas a good organizational feature, or just extra work?

Do Areas in ASP.NET MVC end up being a help or just a drag in the end (because of the URL construction)? Would it be better to have subdirectories inside the main Controllers folder? or are there any ...
2
votes
2answers
330 views

Code execution time out occasionally

I am working on an e-commerce website. There is a case where I need to fetch the whole data in database through a third-party API and send it to an indexing engine. This third-party API has many ...
5
votes
4answers
1k views

What would the general design for an XSD to C# class converter look like?

I am looking to create a simple code generator to convert XSD definitions to C# classes. This is partly as a learning exercise, but I would also like to get some practical use out of it eventually. ...
1
vote
1answer
861 views

JSON object and storage of nosql

I have read Would a NoSQL DB be more efficient than a relational DB for storing JSON objects? and am building a small test project in Asp.Net. I have a webapi up in Azure. It returns a List<Company&...
4
votes
2answers
2k views

Collection interfaces in C#, coming from Java

In Java, I'm used to declaring collections using the most-abstract interface possible and then constructing them using the concrete implementation that makes sense at the time. It usually looks ...
3
votes
1answer
604 views

when is it necessary or when should a controller be async

When is it absolutely necessary for a controller to be async? Should all controllers be async or is it bad practice to make all of them async unless it is necessary. Just looking for some general ...
1
vote
1answer
325 views

Where to put entity model classes in case of using a dataservice layer?

If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong? At first i thought putting them in the ...
2
votes
1answer
455 views

Need help understanding UML diagram

I'm focusing on trying to understand UML diagrams and learning to interpret them in order to implement the designs they describe. In the following diagram, I am not clear on what the implementation ...
0
votes
1answer
313 views

How to justify efforts to make capitalization of class and property names uniform? [closed]

In this thread, an Oracle Product Manager (username "Alex Keh") refused to make Oracle's EF provider to conform with .NET's PascalCase coding standard for class names and property names, saying that ...
1
vote
2answers
253 views

Determining the aggregates in this domain

I'm working on an ordering system where we receive tab delimited files that look like this (I removed most of the columns for clarity): OrderId OrderLineId BuyerName BuyerAdress ...
1
vote
3answers
715 views

Monitoring App: Client side or Server Side?

I have a monitoring web application which has a .Net Backend and a Silverlight frontend. The application crunchs big chunks of data, process them and presentates to user. Then user can interact with ...
2
votes
1answer
6k views

Adding base-class (inherited) functionality to classes that you don't control

I have a set of classes from a 3rd party library. These classes use an inheritance structure to share logic. I would like to add a layer of abstraction in the middle of their inheritance tree to add ...
-2
votes
3answers
752 views

Host an MVC 3 with Razor syntax app on old server [closed]

I just started a new job, I have to create a web app for them and host it on their intranet on an Windows 2003 R2 server with SQL server 2008. As said in the question, I'll work on a MCV3 with Razor ...
1
vote
3answers
417 views

Does non-virtual-by-default lead us to composition-over-inheritance?

There are some design guidelines about testable code in “The Art of Unit Testing”. The first one is “Make methods virtual by default”. I’m curious to know your idea about non-virtual-by-default ...
0
votes
2answers
508 views

Single sign on if you do not have control of one or more of the client/web apps?

I have a customer who has a client app and when they log in to their client app, they will see a link to my website. When they click on the link, it should log in them in automatically to the website ...
8
votes
2answers
3k views

Why do we not prefix Enums, Abstract classes and Structs?

The C# community has so ubiquitously used the "I" prefix to denote an interface that even the most inexperienced programmers know to use it. Why is it then that we do not prefix enums, abstract ...
2
votes
2answers
731 views

Should the search engine return a dictionary or strongly typed objects?

I'm building a search engine using Lucene.NET / Solr.NET, and I'm wondering should search hits be returned as a dictionary or strongly typed object. public class SearchResult { public string ...
5
votes
1answer
3k views

Any ASN.1 parsers written completely in managed code & safe from buffer overflows

ASN.1 is a data format used on HTTPS certificates, and various other critical pieces of infrastructure. I need to analyze some potentially hostile ASN.1 data, and want to ensure my code is safe from ...
3
votes
1answer
1k views

Cookie access within a HTTP Class

I have a HTTP class that has a Get, and Post, method. It's a simple class I created to encapsulate Post and Get requests so I don't have to repeat the get/post code throughout the application. In C#: ...
-1
votes
1answer
681 views

Advanced .NET Generics, and where to start? [closed]

I have been reviewing C# code that has a lot of generics (and generics with generics...) and its taking me longer to grok the code. I know the gang of four patterns, and I know some of the fowler ...
1
vote
1answer
517 views

Refactoring the shipping application code to use DDD factories

I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book. However when I checked the BookingService the code to create a Cargo had this ...
-1
votes
1answer
595 views

Design tips for a program with GUI's for basic, intermediate, advanced & expert users [closed]

I've been asked to develop a program with four interchangeable GUI's so that users can switch from basic to intermediate to advanced to expert mode seamlessly and at will. I have a good understanding ...
0
votes
1answer
480 views

searching for a user given word in a webpage using c# and selenium

I am trying to develop a selenium application (using c# win forms). So, while the application starts, the users will enter an app name in the text box. I have many fields such as cost, validity etc ...
3
votes
1answer
2k views

DI / IoC Abstract Factory Galore

Given a project architecture as follows, where each box represents an assembly (all are class libraries), and each arrow stands for a dependency: Might be worth nothing that this project is massive ...
2
votes
1answer
273 views

How can I distinguish between one-worded expressions and two-worded expressions?

I was told to create two lists concerning most frequently used words from a plain text (10 Mb arbitrary texts) as monograms (for single worded expressions such as human, water, is) and bigrams (for ...
0
votes
2answers
858 views

Handling large web based processes

I am working on a new function for a ASP.NET MVC website. The execution time is quite long at present so I am considering options. The function takes an excel spreadsheet, uploads it to the web ...
1
vote
0answers
395 views

Parallel Programing in C#

I have a code where I have to read some Binary files in database. I wrote a For loop that iterate over my file path array, then it call a READ function that read that file into database. I run this ...
0
votes
2answers
5k views

MVVM pattern - Best design approach to manage an application

One year ago, I discovered the WPF technology and I developed a little application, as first experiment, to compare the content of two different directories. The content of each directory is shown in ...
0
votes
1answer
135 views

Primer on moving around in MVC

It was suggested on my Stack Overflow question that this might be better suited to this site, so I'm cross-posting it. I'm working on my first ground-up build of an MVC site. I have a collection of ...
1
vote
3answers
7k views

What is good practice when inheriting static classes isn't possible/allowed

I am developing a project in C# and due to a design decision it is not possible to have a static class inherit another static class. But I have, in my opinion, a case where this would make sense. I ...
1
vote
1answer
3k views

Moving from PHP to ASP.NET [closed]

I have been working for a long time with PHP, and tried to be as good as possible on it (good coding practices, knowing how every request is handled from the start to the end, etc.), but now, for job ...
0
votes
1answer
306 views

What's the difference between these property definitions in C#

class myClass { int age; public int Age { get{return age;} set{age = value;} } Versus class myClass { public int Age{get; set;} } What's the difference between these two? Are they both the ...
-1
votes
3answers
741 views

Is it possible to encapsulate the object itself within a dynamic property?

I ask this question out of curiosity. Lets say the class Foo is a singleton and I want to call Foo instead of Foo.Instance to access the static object. Would it be possible to encapsulate the ...
2
votes
2answers
1k views

Optimize Reading of Multiple files

I have a unique problem which I'm hoping someone can assist with. I have One big text file, our Production file. The data in the file is delimited in the following format Reference|Cost Centre|...
0
votes
4answers
686 views

substitute for static inheritance

I currently have a number of classes (~20) that all do the same thing (abstractly), namely, generate an instance of a particular class from an xml file. The way that they use the content of the xml ...
3
votes
1answer
672 views

Rewriting C# Formula Calculations in T-SQL

We have a 3-tier application with a C# client that connects to a C# web service via WCF and requests data from a SQL Server database. One feature in our application is a user-created form app in ...
2
votes
4answers
866 views

ado.net or EF for a point-of-sale system

We have a point-of-sale system that was developed using ado.net, our current concern is to make the application real fast in creating transactions (sales). Usually there are no performance concerns ...
1
vote
1answer
413 views

One web service multiple sites

I don't know whether this is even possible or I imagine (according to my habit of over thinking) will bring through numerous issues but let me give it a go. I have an idea where I would like a single ...
2
votes
1answer
800 views

Configuring DI in a decoupled app

I'm reading through Mark Seeman's Dependency Injection in .NET (excellent read so far) and something is escaping me. If the application's architecture is like [DAL] => [BLL] <= [UI], with the ...
2
votes
2answers
274 views

Notifying a separate application of an event

I have an application that runs through various tasks as an automated process. My client would like me to create a file in a given folder for each task as a way to flag when each task completes. ...
8
votes
4answers
10k views

C# Minimal SQL Database

I'm working on a small project (not production) where I'm needing to store enough data that something like a CSV would be inefficient to process and an SQL/MySQL server would be too much. Does .Net ...
6
votes
2answers
1k views

Unit test SHA256 wrapper queries

I have the following SHA256 wrapper. public static string SHA256(string plainText) { StringBuilder sb = new StringBuilder(); SHA256CryptoServiceProvider provider = new ...
2
votes
2answers
4k views

Need help understanding Mocks and Stubs

I'm new to use mocking frameworks and I have a few questions on the things that I am not clear on. I'm using Rhinomocks to generate mock objects in my unit tests. I understand that mocks can be ...
4
votes
2answers
513 views

Hide or Show singleton?

Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such: C#: MyClass.Instance Java: MyClass.getInstance() The question is: when writing APIs, ...
0
votes
5answers
2k views

What would be the fastest way of storing or calculating legal move sets for chess pieces?

For example if a move is attempted I could just loop through a list of legal moves and compare the x,y but I have to write logic to calculate those at least every time the piece is moved. Or, I can ...
6
votes
5answers
12k views

Dependency Injection Confusion

I think I have a decent grasp of what Dependency Inversion principle (DIP) is, my confusion is more around dependency injection. My understanding is the whole point of DI is to decouple parts of an ...
34
votes
3answers
3k views

Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?

In a blog post on F# for fun and profit, it says: In a functional design, it is very important to separate behavior from data. The data types are simple and "dumb". And then separately, you ...