Is it considered poor design to create "black box" User Controls that communicate directly with the service layer (to perform CRUD operations, validation, etc)?
By "black box", I mean that they retrieve/persist data independently of the page they are hosted on (using IoC injected services). Each UC can be dropped onto a page and it w...
In my ASP.NET application I have separate projects for the Data, Business and UI layers.
My business layer is composed of plain objects with declarative validation, using DataAnnotations.
Problem is, when it comes to save them, I'm not sure how to process the validation, since they're not bound directly to any data context, but rather,...
The worst thing when working on a one man project is the lack of input that you usually get from your coworkers. And because of the lack of that you tend to make obvious mistakes.
After going down that road for some time I would need some help from the community.
I started a little home-brew project that should turn into a portal of so...
I have another programmer who I'm trying to explain why it is that a UI component should not also be a data-structure.
For instance say that you get a data-structure that contains a record-set from the "database", and you wish to display that record-set in a UI component within your application.
According to this programmer (who will...
I am new to mocking and dependency injection and need some guidance.
My application is using a typical N-Tier architecture where the BLL references the DAL, and the UI references the BLL but not the DAL. Pretty straight forward.
Lets say, for example, I have the following classes:
class MyDataAccess : IMyDataAccess {}
class MyBusines...
What feature(s) of ASP.Net MVC can replace the way events can be used in Webforms to support loosely coupled components?
For example, take a simple pager control in Webforms:
A page number is clicked
Pager fires off a "PageChange" event with the new page number
This subscribing page/control received the event and handles initiating a ...
I've been puzzled by what I consider a contradiction in terms: ASP.NET MVC claims to be furthering and supporting the "separation of concern" motto, which I find a great idea.
However, it seems there's no way of separating out controllers, model or views into their own assembly, or separating areas into assemblies.
With the fixed Cont...
I know it's important to keep user interface code separated from domain code--the application is easier to understand, maintain, change, and (sometimes) isolate bugs. But here's my mental block ...
Delphi comes with components with methods that do what I want, e.g., a RichText Memo component lets me work with rich text. Other components...
What are your opinions on using web controls in an MVC context?
I came across a good discussion here http://odetocode.com/Blogs/scott/archive/2009/04/09/asp-net-mvc-controls-and-good-versus-evil.aspx but would like to know what the community thinks.
...
Hi,
Background - I'm looking to create a reusable library that allows one to work with a topology map of data. That is data that consists of nodes and relationships between them. The API's would include methods such as "find all children" for which the method would have to "walk the tree" and find all the nodes under this one etc. The...
We have many instances in our application where we would like to be able to access things like the currently logged in user id in our business domain and data access layer. On log we push this information to the session, so all of our front end code has access to it fairly easily of course. However, we are having huge issues getting at...
Hi,
I've got a class with one public method and many private methods which are run depending on what parameter are passed to the public method so my code looks something like:
public class SomeComplexClass
{
IRepository _repository;
public SomeComplexClass()
this(new Repository())
{
}
public SomeComplexClas...
I'm building a Windows Forms system (in C# if it matters to anyone) that provides an application automation service. As this application is targeted at users who are not computer savvy, I've decided to simplify things for the user with a wizard UI. I'd like to avoid coupling the views and view engine (from which the Wizard will be built)...
I would like to know what is the best practice on separating the content of an aspx page (ASP.NET 3.5) from the code (I'm using C#). I have a form that users can type data in - for example they are allowed to enter a percent. If they enter data that's not valid they would get an error message:
<p class="errormsg" id="percenthigh">Please...
I frequently use AutoMapper to map Model (Domain) objects to ViewModel objects, which are then consumed by my Views, in a Model/View/View-Model pattern.
This involves many 'Mapper.CreateMap' statements, which all must be executed, but must only be executed once in the lifecycle of the application.
Technically, then, I should keep them ...
This question may have been asked before, but I'm looking for a different answer than what I've seen.
Our website is in ASP.NET and we use the model-view-presenter pattern to get business logic out of the markup codebehind.
Is there an accepted pattern for web services for getting business logic out of the codebehind? It seems like pu...
I'm trying to be a Good Developer and separate my concerns out. I've got an ASP.NET MVC project with all my web code, and a DAL project with all the model code.
Sometimes code in the DAL needs to check if the current user is authorized to perform some actions, by checking something like CurrentUser.IsAdmin.
For the web site, the curren...
At my current gig, our persistence layer uses IBatis going against SQL Server stored procedures (puke). IMHO, this approach has many disadvantages over the use of a "true" ORM such NHibernate or EF, but the one I'm trying to address here revolves around all the boilerplate code needed to map data from a result set into an object graph.
...
I've been tinkering around with the MVVM pattern and now I'm trying to implement a little application based on it.
This application has a datagrid in which, surprisingly enough, some data is presented. Now I'm trying to add some grouping ability to it. I know how to write this in code (C# and XAML), but I'm wondering in what layer I sho...
Say I have this XML
<doc:document>
<objects>
<circle radius="10" doc:colour="red" />
<circle radius="20" doc:colour="blue" />
</objects>
</doc:document>
And this is how it is parsed (pseudo code):
// class DocumentParser
public Document parse(Element edoc) {
doc = new Document();
doc.objects = ObjectsParser.pars...