.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Using Enterprise Library 5.0 Validation Block with Linq to SQL classes

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

Could anyone show me how to configure the Enterprise Library 5.0 Validation Block with Linq to SQL classes?

View Complete Post

More Related Resource Links

Using the ConsoleTraceListener with the Enterprise Library 3.1 Logging Block


I'm new to using the Logging application block.  I think I have a pretty good handle on how things work.  However, I'm running into a problem.  I'm using the RollingFlatFileListener and I have formatted the logging template to be more like the logging we are replacing.  However, in our console apps when the ConsoleTraceListener is added it still logs it out in the default text template format.  Is there any way to get around this?  Currently it looks like I will have to create a new TraceListener called FormattedConsoleListener that allows a text formatter to be associated with it.  Is this the only way?

Data Points: The Enterprise Library Data Access Application Block, Part 3


E nterprise applications can have a wide variety of data update requirements. Sometimes you need to save multiple rows of changes at once within a single transaction. Other times, the user must be allowed to enter multiple rows of data, send them to the database in a batch; and if a row or two fails, only the rows that succeeded should be committed and remain committed.

John Papa

MSDN Magazine October 2005

Data Points: The Enterprise Library Data Access Application Block, Part 2


Last month I explored the foundation of the Enterprise Library Data Access Application Block (DAAB) including how it all fits into an architecture (see Data Points: The Enterprise Library Data Access Application Block, Part 1).

John Papa

MSDN Magazine August 2005

Data Points: The Enterprise Library Data Access Application Block, Part 1


A solid data access later (DAL) can benefit an application by hiding redundant tasks, helping handle exceptions more gracefully, helping clean up resources more efficiently, and providing a layer of abstraction from the database.

John Papa

MSDN Magazine July 2005

Enterprise library exception block

Hi experts, I am developing an application in two database Oracle & Sql Server, but i want to implement common Exception Handling for both dbs using Enterprise library please suggest me if possible   Thanks in advance

Validation from the Enterprise Library

Hello all, I have a question about validation.  Basically how the MVC framework is setup it can use DataAnnotations.  It calls TryValidate in a controller which does some other black magic, and poof, you have a ModelState with validation results.  Now to extend this validation you can create a validator and then provide custom validation on both server and client side.  Here is the problem... what if you dont want to hard code all of the validation in the classes?  I would like to use what Microsoft has already provided in the Enterprise Library (http://msdn.microsoft.com/en-us/library/ff650131.aspx) for validation.  I will be using both DataAnnotations and configured rule sets.  Of course I could just put the code in each action, but that is so 1999.  As I see it the MVC framework falls short by not allowing us to use the config for such things.  Why is the validation so specific for MVC?  Why could it now have used the Enterprise Validation?  I wrote my own abstract controller and put in Enterprise Library validation and it worked GREAT!!!  So why am I here?  Well, surly there must be a better way... do I really have to write my own controller abstract class to change the validation?So if you think you know how to solve this problem, you must provide a solution that does this:Uses DataAnnotations AND Configurati

Microsoft Enterprise Library 5.0 - Logging Application Block Activation Error


Hi folks,

I've been writing a class where I wanted to write the errors off to the OS EventLog. I was pointed towards the Logging Application Block. I used LogWriter successfully in a web page and transfer the code to the class so that I could have the functionality there.

I keep getting an {"Activation error occured while trying to get instance of type LogWriter, key \"\""} Error when I reach this line of code:

private LogWriter writer = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();

I had something similar with the daab getinstance call but I added the unity assemblies to the code and this resolved this. I thought this was the issue with this problem.

Could anyone tell me what I'm doing wrong?

Thanks in advance folks.

app.config code:


<?xml version="1.0" encoding="utf-8" ?>
        <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />

WCF and Enterprise Validation Block

Hi All, I am in a development of a WCF service which is using WCF Enterprise Validation blocks. How can i  localize the messages in the Fault Exception. Thanks and Regards Viju

how to write wrapper for Data block of Enterprise library




I have the following scenario.

The project has 4 layers

1) Business Entities

2)Business Layer


all are separate projects
so lets say

1 )Business Entities has

public class Employee
public int EmpId{get;set;}
public string EmpName{get;set}
pullic int Age{get;set;}

2)Business layer will call dataacess layer

public class BusinessLayer

public int RegisterEmployee(Employee objEmp)
 Datalayer objDal =new Datalayer();


3)From the datalayer i need to call Wrapper for enterprise library and the requirement is
datalayer should not have any reference of Enterprise library data block(that i dont know how to do that)
Only the wrapper class should have reference for Enterprise library data block


public class Datalayer
 public int AddEmployee(Employee objEmp)
///Database db=DatabaseFactor.Createdatabase()
//the above line should not be in datalayer it should in some other componenent
//lets say component is wrapper
//i want to how to write wrapper for that.
//As well as how to build command and parameter



VseWSS 1.3 Deployment error related to Enterprise LIbrary(Exception Handling block)


We are getting the folllowing error while deploying VseWSS 1.3. There seems to be an issue with Exception Handling Block.

There no more detail in log file except for this error as shown below. We did a complete reinstall of VS 2008 and VseWSS and Enterprise Library, but the error persist.

Is there some incompatibility issue with VseWSS 1.3 and EL? Has anyone come across this error before:



Microsoft.SharePoint.Tools.Utilities.VSeWSSServiceException: VSeWSS Service Error: The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, CommonErrorPolicy]) failed: Object reference not set to an instance of an object. (Strategy type ConfiguredObjectStrategy, index 2)


Log fil

Scale Up Enterprise Library Caching Application Block


CAB from MS is a very famous tool for the developers as it saves a lot of valuable time of the developers. But anyone who has decided to use CAB, should also keep into mind its limitations as well. The cache in EnltLib is stand alone and in-process in nature that’s why it can ends up with some scalability and reliability issues when used in a multi-server environment. But there are some party integrations which can over come this issue. The most popular way to overcome these limitations of CAB is the use of a distributed cache. The article about the drawbacks of CAB and it solutions can be a very helpful read in this regard. 

Help- Enterprise Library Logging Block (Database trace listener)



I'm new to enterprise application blocks. I'm trying to use database trace listener to write the logs to Database. Can someone help me on this .

I would apprciate your response.







MVC + Enterprise Library


Not a MVC specific question, but as that's what I'm doing I thought I'll post here.

While looking into the source code of an existing application, I stumbled upon MS Enterprise Library, and as I only heard about these "application block" stuff decided to look into it.

From the theory it sounds like a pretty usefull thing and it made me wonder if other's are using it succesfully along with MVC projects (I know they are not really related!)?

Pro's and Con's? 

I like the database block, as I did not get to any real database development the last 1.5 years, for instance. (Bad excuse I know).  Having an IoC thrown in there (Unity) sounds like I can pretty much stop using 3rd party libraries like I do now all over the place.

set messageTemplateResourceName from resource file in Validation appication block.



  I am using Validation application block in my project and want to set validation message from resource file, but not able to do that. I tried giving the path of resource file in messageTemplateResourceType and name of resource in messageTemplateResourceName. But it did not help as I only receive the message if I have set something in messageTemplate even after setting the resource file.

Here is my code:

<validator lowerBound="1" lowerBoundType="Inclusive" upperBound="250"
              upperBoundType="Inclusive" negated="false" messageTemplate=""
              messageTemplateResourceType="Asurion.jCare.Common.Resources.UIResources.PerilTypeAndDetailsSection, Asurion.jCare.Common.Resources, Version=, Culture=neutral, PublicKeyToken=null"
              tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidator, Microsoft.Practices.Enterpris

Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


Hi ,

I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

 Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


Thanks In Advance.

Using Enterprise Library for first time



I wan to use the enterprise library for the first time. Is there any samples, quick start guide or ebook is available for a quick start and learn the basics.

I have vs2008, so which version of EL should I use?

And if somebody can just brief about Enterprise Library. Because as per my understanding, is this a mixture of design patterns and some pre-made blocks of source code.





CLR Inside Out: New Library Classes in "Orcas"


The next version of Visual Studio currently code-named "Orcas"supports advanced encryption algorithms, Elliptic curve cryptography, big integers, and other security enhancements. The CLR team explains.

Mike Downen, Inbar Gazit, and Justin Van Patten

MSDN Magazine April 2007

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend