enterprise-library

Logging to files or to event viewer?

Hi, I was wondering what is the 'correct' way to log information messages; to files, or to a special log in the event viewer? I like logging to files since I can use rolling flat file listener and see fresh new log from each day, plus in the event viewer I can only see one message at a time - where in a file I can scan through the day m...

Making validation part of application settings

I am looking for examples of configuration based validation using Validation Application Block. I've found this I want to ask if someone has an alternative solution to using EL VAB 5.0 to achieve configuration based validation. I've started with DataAnnotations but soon found out that some properties will need different types of validat...

How to log exception to MS SQL database using MS Enterprise Library?

Hi All: I already logged thrown exceptions to text file , now i want to log them to MS Sql database but i couldn't find clear sample to perform this task. ...

How to instantiate unitofwork

Hi. I am using Dependency Injection pattern to resolve correct instance of mine UnitOfWork. When I am using only one type mapping, all is ok unityContainer.RegisterType<IUnitOfWork, UnitOfWork>(); The problem occurs when I am using two type mappings for the same interface: unityContainer.RegisterType<IUnitOfWork, UnitOfWork1>(); ...

Override Log.Write in Enterprise Library

What I am trying to do is pass multiple parameters to Log.Write without first creating a long string of them with newline escape characters. Here is my current function: public static void LogPipedEvent(string message) { //Split message on double pipe escape "||" string newmessage = ""; string[] splitMessage...

Entity Framework + Unity Framework

Hello, I beginning a new project and I need to create a Project for implementing Entity Framework 4.0 and Unity Framework 2.0 along with Enterprise Library 5.0. I am very new to Entity Framework and Unity Framework and getting confused in how I can get normal Object BO's and DAL with Database. Can someone point me to some simple exampl...

Logging queries with Enterprise Library

I'm using Microsoft.Practices.EnterpriseLibrary.Data.Database to create my accessors and execute my queries. I'd like to know if there is anyway, within this scenario, to automatically log all queries and parameters that are being sent to the database. ...

Intercept DataService Calls

I want to use Enterprise Library 5 and Unity to intercept calls made on some WCF Data Services. If I wanted to do this on a custom object I would have an IMyObject interface and a MyObject implementation. I would then include some config in my web.config along the lines of the following (I want to add performance counters in this instanc...

ExecuteSprocAccessor how to return string from stored procedure?

I am using Enterprise Library 5, set up the Database successfully but am now facing the following problem. I have a stored procedure which is a simple select statement which returns 1 string (not an output parameter). In code I wrote: var result = _db.ExecuteSprocAccessor<string>("GetTypeOfPerson", mapper, parameters); However this ...

How to find this reference ExceptionManager.LogException in C#?

I have a piece of code that I got from MSDN and I am not sure how do I reference this class? It mentioned about Exception Management Application Block ... is this an old version of Ms Enterprise Library? catch (Exception generalException) { ExceptionManager.LogException(generalException); } ...

How can I stop the Enterprise Library caching block from persisting changes to data I've retrieved from it?

What an awkwardly worded question, you're thinking? When my application loads, it goes to the database and gets several different lookup tables worth of data and creates .NET Lists for each one and puts them in cache. For example, "Status". List at this point: On, Off When I retrieve the List of Statuses from the cache, I add another...

What logging listener should be used in production? (ASP.NET / Logging Application Block)

I'm using MS Enterprise Logging Application Block in an ASP.NET website. For production launch, I will set up a log listener in one of these locations: Sql Server database Windows event log Text files Which has the least impact on performance? NB - I can't switch to Log4Net or ELMAH at this point, so please don't suggest that in yo...

Metadatatypes with self-validation using validation application block

Is it possible to use the selfvalidation attribute with my validations located in a metadatatype? I'm using Enterprise Library 5's Validation Application Block. ...

WCF and Validation application block: Impossible to customize error messages?

When using WCF together with Enterprise Library 5.0's validation application block, is it possible to customize the error messages which are sent back to the client? I've added the ValidationBehaviour-attribute to my service contract and the FaultContract-attribute to the operation: <ServiceContract()> _ <ValidationBehavior()> _ Public...

ExecuteSprocAccessor does not function for CUD operations?

I have several stored procedures in my database. For example a delete stored procedure like: alter procedure [dbo].[DeleteFactor] @Id uniqueidentifier as begin delete from Factors where Id = @Id end When I call this from code like this: dc.ExecuteSprocAccessor("DeleteFactor", id); then the row does not get deleted. However this...

Entlib validation ErrorMessage not working with MVC ValidationMessageFor

I'm using the combination described on the title. If I use DataAnnotations the ErrorMessage I set is shown correctly on MVC 2 form validations. However if I switch the validation to Entlib 5, with the same ErrorMessage property set, the error message shown is a deafult one, depending on the validator, and not the one I set. Before, work...

Set command Time out for enterprise library 4.1 data access?

I am trying to set command timeout for enterprise library 4.1 data access. I used below code for get command object from Database. Dim dbCom as System.Data.Common.DBCommand dbCom = dbCon.GetDatabase.GetStoredProcCommand(sprocName, parameters) dbCom.CommandTimeOut 'I dont find this property. How to set CommandTimeout? ...

Enterprise Library Validation Block - Validate conditioned to another property value

I need to validate two fields only if a third field has a specific value. In this code snipper i suppose to use a CheckIf properties that not exist. It is possible to validate a field only if another property hase a specifica value ? public string CustomerType { get; set; } // P=Private B=Business [NotNullValidator(MessageTemplate = "Y...

Enterprise library, stored procedures and transaction scope

Hi I have enterprise library 4.1 in a c# 3.0 app. The database is SQL Server 2008. I have created an entity class in the designer (based on base class 'ObjectContext'). In this entity there is a function that hooks into a stored procedure on the database. The stored procedure handles the insert of a record into a table. Nothing else. The...

If Using Enterprise Library, Is log4net better to log with?

Hello, For a project we are using Enterprise Library 5, and will be using several of the blocks. I'm inclined to use the Logging application block since its built into this framework. But I do see a lot of recommendations for log4net, so what have people chosen to do and if choosing log4net, why did you choose it over some of the othe...