Architecture :: Validation, Service Layers And Testing?

Dec 23, 2010

I have a quick question in regards to testing my validation. I have been looking through a few MVC examples and have noticed the 'Validating with a Service Layer' tutorial which is pretty nice. It discusses how to abstract your code out etc..My question is, that they have validation occuring in the service layer, if errors occur, the error + message then gets added to a model state dictionary.Now i want to test my model to make sure my business rules are being applied to it, but with this approach, for starters, the Validation method is not in the interface. Now, if the validation method was in the interface, during testing you would have to re-implement the validation on the testing side.Am i missing somthing? Where should your validation code go? I feel like it should go in the model, but then i have to track the errors on the model side.

View 1 Replies


Similar Messages:

Architecture :: Unit Testing - Testing Private Methods Using PrivateObject?

Feb 23, 2011

Recently for a class to implement unit test for one of its private methods I used PrivateObject by creating private accessor instead of refelection, to which i received a code review comment as below

"My main concern with Private Object is the use of object[] in constructor. It replaces strong typing enforced by compiler with JavaScript-style run-time error detection.Consequently , personally, I would not recommend it."

Comments above confused me beacuse as per my understanding reflection also needs the object[] to invoke any method.

View 2 Replies

Architecture :: Using Linq To SQL, What Layers Should Use

Nov 18, 2010

I want to use Linq to SQL in my web projects. I mostly work in small and medium size projects. Please guide me what layers I should use ?

Previously I was using DAAB and was using 4 layers (business objects, business logic layer, data access layer and user interface).

View 5 Replies

Architecture :: How To Pass Data Between Layers

Jul 6, 2010

I have three layers like UI, business and data access in my asp.net web application project. If I pass say a company code from the UI to the business to the data access and I query the company details like company name, address, phone etc from the database using sqlhelper executedataset() which wil return me a dataset. Then how do I pass these company details back to the UI layer. Is it correct to just pass the datatable object to the business and UI.

View 6 Replies

Architecture :: Modelling Application Layers?

Jan 26, 2010

I'm trying to create my first Asp.Net application from scratch. Tried to create this post in some of the other forums but I couldn't find a better place.

So, as the title says, I'm having trouble trying to model my application. I'm like an OOP newbie. I'll show my classes first and then I'll write my questions.

Model Layer

public class User
{
private int id;
public int Id { get { return id; } set { id = value; } }
private string login;
public string Login { get { return login; } set { login = value; } }
private string password;
public string Password { get { return password; } set { password = value; } }
}
Data Access Layer
public class BasicDAL
{
private SqlConnection connection;
//>>Returns a new connection to the database
public SqlConnection GetConnection()
{
//>>If connection is active close it before starting a new one
if (connection != null)
if (connecion.State != ConnectionState.Closed)
connection.Close();
connection = new SqlConnection("MyConnectionStringHere");
return connection;
}
}
public class UserDAL : BasicDAL
{
//>>Insert a new user
public void Insert(User user); { /* Insert into DB */ }
//>>Authenticate user login with its password
public void Authenticate(User user); { /* Authentication code here */ }
}
Business Logic Layer

[Code]....

So, model layer is pretty simple. Just a user representation. On the Data Access Layer I have a basic class with a GetConnection method. All DAL classes will extend this one.

My first problem lies on Business Logic Layer. With the above scenario, I've placed the same methods that I placed at the DAL. BLL methods would call DAL. As simple as that but I believe It is not the best way to do it, is it? How can I improve those classes?

Also, I have to "try..catch" blocks. That's because I can't find good places for it. I mean, if I place a try..catch on GetConnection method, for instance, how my ASPX page would get this error? How my ASPX page can tell the difference between "database offline" and "sql syntax error" when executing "userBll.Insert(newUser);".

My problem is mainly placing the exception handlers. I understand I would probably have to change return type of some methods. I didn't change because I believe that will have something with the exception handlers.

Btw, please assume I can't use TableAdapters and stuff like that. I would like to create all layers by myself.

View 3 Replies

Architecture :: Dropdownlist Values And Layers In Application?

Mar 13, 2010

Here is the scenario.

Every project has a Supervisor.

When I select the supervisor for a particular project, I'm using a dropdownlist.Table is like this

ProjectId | SupervisorId | ......
--------------------------------------

1 | 1

In my application, I'm binding a Collection of Supervisor type, which I'm feeling that it is an additional overhead. Becuase I only want his ID. So binding an object collection to the dropdown which seems no worth.

View 5 Replies

Architecture :: Entity Framework With 3 Layers Design

May 19, 2010

I am thinking to use entity model as DAL, how should I create the BLL then? What kind of datasourceobject should I use in the asp pages?

I am looking for best practice to use Entity framework 2 in the three layers design. I had experience at dataset with three layers design.

Should I use objectdatasource at the pages for gridviews? My guess is that entitydatasource by passed the BLL which is not good, so the only option left is the objectdatasource.

Could and should my BL object inherit those entity model in the DAL, so I dont need to recreate their object's property?

View 4 Replies

Architecture :: Inherited DTOs, How To Implement The Layers Facade, Bll And Dal?

Feb 18, 2010

I doubt how to implement the layers
FACADE, BLL and DAL, using
DTOs specialized ..
where:

public class ClassA
{
private int _Test1;
public int Test1
{
get { return _Test1; }
set { _Test1 = value; }
}
}
public class ClassAB : ClassA
{
private int _Test2;
public int Test2
{
get { return _Test2; }
set { _Test2 = value; }
}
}
public class ClassAC : ClassA
{
private int _Test3;
public int Test3
{
get { return _Test3; }
set { _Test3 = value; }
}
}

In the database, there is the 3 tables, as described above.how do I implement the facade, bll and dal? only one class for 3 DTOs?

View 3 Replies

Architecture :: Design Which Have A Few Layers:Common, DataAccess, BusinessLogic,Operational?

Jun 24, 2010

It's appreciated if you could share your thought.I have seen a e-commerce website design which have a few layers:Common,DataAccess,BusinessLogic,Operational.In the Common layer,it includes all the classes with only attributes and properties,no methods nor data access codes here.

In the DataAccess layer,there is a class for each action per class in the Common layer.For example,

a class for the Select action of class A of Common layer,
a class for the update action of class A of common layer,
a class for the Select action of class�B of Common layer,
etc...
Is this a design I could use for a potential high trafic website?What's the pro and con of this design.

View 3 Replies

C# - How To Handle Input And Parameter Validation Between Layers

Mar 5, 2010

If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer?

Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?

View 6 Replies

Architecture :: Unit Testing Delegates With Mock Framework?

Apr 3, 2011

I'm using the mock framework to unit test some methods. I came across some methods that use delegates. I did not find a way to setup these delegates to return the objects that I want. The mock framework does not support it as far as I know. Is this supported in other mock frameworks like nMock?

View 3 Replies

Architecture :: How To Design A Centralized Business Or Service Authentication Architecture

Sep 22, 2010

i want to create a centralised business or Service authendication architecture in .net. for example, we have a clients like c1, c2, c3, c4, ... etc. everybody logins seperatly as well as grouply. ie, if client "C1" logins [with login authentication] he can access c2 , c3, c4 also without login authendication. So its like a google. if we enters gmail account, we can access orkut, picasa like that.. i need the cetralised architecture.

And, client "c1" seperately asks seperately how will be the authendication architecture.

so give me the single solution for both these two scenarios. how will be the architecture for these two and how is the Data Base (Login) Structure.

View 3 Replies

Testing A Windows Service?

Nov 5, 2010

using vb.net 2005.

what is the best and easiest way to test a windows service while developing it?

View 5 Replies

Architecture :: Architecture FOR SAAS ( Service As A Product)?

Dec 22, 2010

I am going to create the SAAS (Software as a service) Application. Can you please provide all the attributes that we have to consider in SAAS application (for example usability, pluggable architecture etc .. )

How architecture should be build for this project, provide sample architecture for SAAS application. This architecture should be easy to upload and upgrade or degrade the features. Error handling should be easy.

View 2 Replies

Architecture :: Create architecture design For WCF Service?

Aug 10, 2010

I am try to create architecture design for WCF service.

We have WCF service that we have to expose to third party so then can request with xml and get back xml response.

The wcf service should do the following:

- Accept the request call with xml

- Check xml against the schema

- Parse the xml

- Authenticate the incoming xml by username and password that will be in xml

- Send back the response

If anybody can let me know what kind of design I can use or is there any pattern available that I can take it and then extend it as per my requirement.

View 2 Replies

Architecture :: WCF Service Be Used To Receive Data As Needed From A Remote Sender Or Service?

Feb 25, 2011

I am not sure which approach I should use. I have a web application that needs to get/receive data from a third party application that is in a secure remote network. The data needs to be secure during transport. The data layers cannot be exposed and the databases will not talk to each other. The data will be received from remote application on demand, or will get at scheduled intervals.

I have looked at WCF, but not sure if this will work. Can a WCF service be used to receive data as needed from a remote sender or service? Is this a secure way of doing it? I have also looked at SFTP using some XML/XSLT, but I don't think this is the right way to go. In addition, some data may be transported from my web application to the remote application (mostly reports at first). What protocols are used to transfer data between HIPAA compliant applications?

View 7 Replies

Architecture :: DAL As Web Service - Adding A Service Reference To Project And Then Using The EF4 Context And Writing LINQ Queries Against The DB?

Feb 10, 2011

I'm currently trying to work out the best way to build this web application, which will then be intergrated on other systems, such as WinForms, Intranets etc.

We hope to include the usual layers i.e. DAL, BLL, BOL and UI but I have been experimenting with Entity Framework 4 and WCF Data Services and managed to get something in place where I was using WCF as a gateway to EF4.

i.e. Adding a Service Reference to my project and then using the EF4 context and writing LINQ queries against the DB

e.g.[Code]....

Now with the current setup I would still need to write a DAL Class Library, that interacts with the Data Service, because as I said WCF Data Services only seems to be a gateway, I can't see where to put the code (above) in the Data Service and then how I could these methods.

My questions are: 1. How do I develop a WCF Data Service in such a way to allow this behaviour - I know how I could do it using ASMX web service, something like [Code]....

2. If I am to use WCF Data Services, how is serialization handled (if at all) - again I know how to do something in ASMX web services

3. Again, If I am to use WCF, how do I add Security and only allow my applications to access the web service - for obvious reasons

4. Would it be possible / logical to also include the Business Logic Layer into the web service?

View 4 Replies

Visual Studio :: Testing A Simple Web Service?

Jan 20, 2010

So I started a new solution in vs2010b2.

1. I added a WebService project to this solution.

2. I added a WebApplication project to this solution.

3. I clicked Add Web Reference

4. I clicked Web services on the local machine

5. Web Services listed on my local machine:

"There was an error while enumerating services on local machine:

Active Directory Services cannot find the web server. A possible cause for this is an incompatibility between versions of Internet Information Server (IIS) on the client and the server. Another possible cause is that IIS is not installed on the local machine, or the user identity under which you are running may not have permissions to view websites on this machine. To view websites on this machine, make sure that you run Visual Studio as administrator. On Windows Vista computers with IIS installed, make sure that
IIS Metabase and IIS 6 configuration compatibility feature is enabled."

I have Visual Studio 2010 beta and Visual Studio 2008 Professional installed on this computer. I do not have any IIS server installed. Do I require a IIS server when coding webservices+webapplications?[URL]

View 1 Replies

WCF / ASMX :: Testing Web Service With No Port Number?

Jun 18, 2010

The way I quickly test the asmx file is to "View in Browser" from Visual Studio (I'm using 2005, and have IIS 6). The address shows up like this:

"http://localhost:1399/MyWebService.asmx"

where 1399 is a generated random number and can change each time I test by this process.

The books I've been reading (as well as other sources in the internet) keep referring to testing web services by typing something like this in the browser:

"http://localhost/MyFolder/MyWebService.asmx"

where "MyWebService" is the name of the web service and "MyFolder" is where that webservice is.

This "http://localhost/" with no port number testing never worked for me. Some books mention random port numbers, but most do not even mention port numbers. [URL]

View 6 Replies

Web Testing Software - TFS And Visual Studio Testing Tool.

Jan 18, 2011

am working as a web developer in a company. I am not aware of anything related to testing. Our company is planning to buy some testing softwares. Presently we are working on ASP.NET. We will be working on PHP and JAVA in future. I need your help to find out the best but cost effective testing sofwares.on TFS and Visual Studio Testing tool.

View 2 Replies

Integration Testing Web Services Against A Testing Database?

Oct 27, 2010

I'm currently building a .net web application that uses WCF web services to allow a Flex front end to access the database.

I'm in the process of setting up some unit/integration style testing on the web services and am trying to work out the best way to allow the tests to access and modify data in a separate test database.

Currently, the connection string in my unit test project points to my testing database, and the connection string in my web services project points to my development database. However, as I am using Linq it appears that when I call the web service methods from my test class, it uses the development database connection string. I have looked into creating mock objects or in-memory database but I believe the same issue would occur.

Is there a way to get this to work, or is my entire idea about what I want incorrect, in which case is there a better way to set this up?

View 3 Replies

Architecture :: Data Validation In Repository Pattern?

Dec 21, 2010

I am currently using the 3-tier Repository pattern in my application. Actually it's the first time for me to implement a design pattern at all! i used to put all my code in the so called now presentation layer.

i want to implement data validation, for example, password should not be more than 10 characters and have to contain special characters. Should i put this code in the data access layer? but my data access layer contains methods that take the DTO as a parameter for example

[Code]....

and the same is for other CRUD operations (DELETE and UPDATE), so implementing such validation on the DAL would make me duplicate the code in each and every method that accepts the DataObject as a paramter. Same holds for the business logic layer where i am using it as a proxy between the presentation and the data access layers.

Eventually it has to use the same Data Objects as parameters. This only leaves me with one option which is to do the validation on the Data Object part. But i think this is not the essence of the respository pattern which states that the Data object class should only be a "container" class with no behavior.

View 1 Replies

Architecture :: Data Validation In A 3 Tier Application?

Aug 31, 2010

Say you have a form designed in Silverlight(Front end)-Asp.NEt(business layer)-SQl(bakcend)Should data validation occur on all 3 layers or just the presentation layer or a combination of the front end with the other 2 e.g. validating an email address? I'm trying to undestand as to why if data has been validated on the presentation why further data validation would be necessary especially if there would be large amounts of data being validated and this could potentially slow down database transactions?

View 4 Replies

Architecture :: Using Windows Service In Web Application?

Sep 10, 2010

I wanna embed the windows service in the web application. I have seen few posts in the web. where they generate separate exe for the windows service and use it as an installable.

The same process i tried doing it but it threw an OS error in my server which is windows 2000 and didnt supported the executable.

However the website of mine runs fine in the same server. Thus i was thinking if i cd embed the same code in the web application.

Also, in my case the website of mine takes job for simulation. These jobs are taken for simulation execution and nearly takes 12hrs for completion and if they are not completed within twelve hours then they are supplied extra twelve hours to complete the simulation jobs.

The simulation executables are a series of executable and bat files.

The results of the simulation gets updated in the tables of MySql and hence are displayed to the user.

View 2 Replies

Architecture :: Invoke Client From Web Service?

May 31, 2010

I've a web services wich can invoke a pc on the internet when a new event has come.

How do I write the code?

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved