DataSource Controls :: Is It Mandatory To Close Database Connection In Enterprise Library 4.1
Mar 23, 2010Is it mandatory to close database connection in enterprise library 4.1?
View 1 RepliesIs it mandatory to close database connection in enterprise library 4.1?
View 1 RepliesI am using microsoft enterprise libarary to connect to mysql using mysql .net connector (latest version 6.2.3)
But i am facing a problem of too many connections and connection pool reached maximum limit issue.
As connection is disposed by enterprise library iteself so i dont close the connection anywhere.
So after two or three hours i found i have 100 mysql connections in sleep mode which are doing nothing and are not being reused from the code .
So i want to ask is there any issue with my code or is there any issue with mysql connector
When I'm using this to open Connection to DB,
Do I need to Close it at the end?
Or by using it, it close by itself?
using (SqlConnection cnn = new SqlConnection(connectionInfo))
How do i configure connection string for Asp.Net Membership Provider? Do i have to write it by hand or any tool is available in Visual Studio where i can specify connection string as well as algorithm used to store password? I read one article and it specifies this connection string :-
<configuration>
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=appservicesdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
This LocalSqlServer name doesn't sound too intuitive. How do i change this?
does DbCommand.Dispose() automatially close the database connection?
Here is my code:
Database db = DatabaseFactory.CreateDatabase("DBIS");
string sqlCommand = "procUIBillingAdjustmentsCreditInvoicedSegment";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
DataSet ds = new DataSet();
[Code]....
I am using Enterprise library for my data access. when I am running the application, at the CreateDatabase() statement I am getting this exception:
Microsoft.Practices.ObjectBuilder2.BuildFailedException was unhandled by user code Message="The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, null]) failed: The value can not be null or an empty string. (Strategy type Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy,index 2)" Source="Microsoft.Practices.ObjectBuilder2"
Now, I googled a bit and I found that I have to place
<dataConfiguration defaultDatabase="LocalSqlServer"/>
but I don't know where. Is it the right solution? Also, at the time of installing enterprise library I didn't see any connection string statement? So, I wonder how it will take the connection string from web.config file. In the connection string section of my web.config file I have:
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=MSTR;Initial Catalog=USERDb;Integrated Security=true;" providerName="System.Data.SqlClient"/>
I wanted to get any feedback (put out a feeler) for how the enterprise library plays with linq-to-sql generated classes. I was considering using the validation handler to provide validation logic/display to the UI level. I am considering the caching handler, validation, and authorization handlers primarily.
View 1 Replies 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 [URL]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 Configuration RulesCan validate the SAME in a console application (could really be any non-web app) and MVCI do see that MVC 3 adds a little more support for validation which was really needed. It supports IValidatableObject, which allows you to validate the whole Model... its nice, but now we have 3 ways to do that same thing... granted the former 2 (DataAnnotation on the class, and a Validator for the DataAnnotation) could not pass the error to the correct place in the view. Now if we could just support all of this validation in a place what any type of application could use it. In my use case I will run validation on the MVC app, perhaps some other apps, and on an ESB.
I'm trying to learn the Enterprise Library. I found this useful code sample to get data from a SQL database. But I tried to send data via a parameter. I'm also using the UPDATE, DELETE, and SAVE methods. Can you give me a similar sample? I'm using Enterprise Library 4.0.
[code]....
Recently i have joined a new project that is to be build from scratch.(goal of the project is to reach the users across boundaries : windows, web & mobile)
I follow architecture having following layers:1.Presentation Layer 2. Logic Layer(BLL) 3. Business Objects 4. Data Access Layer.
But this time i wanted to use new technologies Microsoft have introduced like Entity Framework 4.0 , WCF services.
So i have thought of creating the layers like
1.Presentation 2. BLL 3.Services 4.Business Objects 5.DAL
but i am in confusing state how to use Entity Framework. in the above layered diagram.If there any flaws in the above layered diagram do guide me.I have heard of Microsoft Enterprise Library(MEL) 5.0. What exactly it is?
Will i get benefited with MEL 5.0.
I am using a adapted version ofhttp://www.mikesdotnetting.com/Article/45/Programmatically-accessing-data-from-DataSource-controlsDon't we need something like a closing-routine / close connection command after getting data from the database?If yes: What is the correct closing command?
View 2 RepliesDoes MS have a sample enterprise application that demonstrates the use of different Enterprise library blocks (Logging, Dataaccess, Exception, Validation etc)? I am looking for something that uses best practices in using and integrating all these blocks in a single application.
View 3 RepliesIs there a simple code to populate a dropdown box using Enterprise Library 5.0 DAAB? I've tried this, but it is not working:
cmbOffice.DataSource = _db.ExecuteDataSet(
CommandType.Text,
"select office_id, office_name from office").Tables[0];
cmbOffice.DataBind();
Has any one used Microsoft's Enterprise Library, if so what parts of it did you use? I am using building a website (I guess the client app type is not important, it can be a Windows app as well) with all the architectural layer, and I am specifically interested in the exception handling, logging and caching blocks for now. Any one used these, what were the good and bads of your experience with, any alternatives that you rather decided to use? Performance is a thing that I am also interested in. I am looking for a decent exception handling framework which is how I came across the exception handling block. Anything other out there? Is it a wise idea to use the data access block with an MVC application seeing that everybody is the repository pattern with an ORM framework? I am still researching frameworks, so I would like to hear as many opinions.
View 1 RepliesThe CachingCallHandler included in Enterprise Library 4.1 was removed for Enterprise Library 5.0+. The documentation refers to using the Enterprise Contrib Library to get this functionality, if needed.My questions:Where is this functionality in the Enterprise Contrib Library?Does this work with Enterprise Library 5.0?This is the only functionality I have a definite need for from Enterprise Library but may want to use the validation, as well. I don't see any reason to start with 4.1 when newer versions already exist. But, I'm slightly confused about where to find this functionality.Of note, I don't see this method listed on their page.. still searchingI think this is the namespace, and I don't see the file in the latest download.
Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers
[Code]....
I can check whether username exists or not successfully but not for email. any ideas why it isn't working? Error message was that i did not close my connection. using System;
I've VS2008 and enterprise library 4.1 installed .I want to display few records in the categories table of my NorthWind in my presentation layer through data access layer with enterprise library. I've added references of the following dlls in my data access layer project( which is of type class library)
Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.ObjectBuilder2
how to access data from the database using datareader , entity beans and rendering data on to presentation layer.
I just downloaded entLib 4.1. Part of the download process included a DOS bat file that ran for a while. Being completely new to the Enterprist Library I have no idea how to use the Enterprise Library. Online support mentions something about accessing the blocks through the References folder in the Solution Explorer - but I don't have one in my solution explorer. How do I get the References folder to appear so that I can start figuring out how to use the application blocks?
View 7 RepliesIs there any simple DAL Generator for SQL Server/ MS Enterprise Library/VB.NET or C#?
View 7 RepliesI am new to asp.net development and using enterprise library in my application in the following way.
Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetStoredProcCommand("sp_MakePayment");
db.AddInParameter(cmd, "@BillGenID", System.Data.DbType.Int32);
db.SetParameterValue(cmd, "@BillGenID", billgenID);
db.AddInParameter(cmd, "@PayDate", System.Data.DbType.String, 50);
db.SetParameterValue(cmd, "@PayDate", mypaydate.Text);
db.AddInParameter(cmd, "@TransNo", System.Data.DbType.String, 50);
db.SetParameterValue(cmd, "@TransNo", transno.Text);
db.AddInParameter(cmd, "@AmtToPay", System.Data.DbType.Double);
db.SetParameterValue(cmd, "@AmtToPay", Convert.ToDouble(paidamount.Text));
////Execute Stored Procedure
int i = 0;
i = db.ExecuteNonQuery(cmd);
Now I am in a situation where i need to run this inlnie query using the same method to get the count of records and read in a variable. for example following query to find existing bill.
string bill_id = "1234";
string dofpayment = "11/03/2011";
mysql = "Select count(*) from payments where bill_id = " + bill_id + " and payment_date = " + dofpayment ;
Now how to incorporate the above lines using the enterprise library block.
We use the caching and logging application blocks from entlib 4.1. We want to keep the configuration of those two in seperate files. How can we achieve this?It looks like entlib is always using the selected Source as it configuration.I tried the following:
[code...]
But this doesn't work because the application blocks always use the selected Source attribute value.
In IIS7 I don't find any possibility to keep a website from responding to it's IP address as soon there is SSL set up for this website. I did not add the IP address as hostname for this website and so would expect that the site does only respond to it's given hostname(s). Unfortunately the website won't work if requested via it's IP address, so I have to disable IP address as hostname somehow.
Another issue is that IIS 7 does not display the "secure connection obligatory" error page anymore if secure connection is mandatory for a website. Is there any way to get this error page being displayed, just like it was in IIS6 ?
I have a web service that I developed on my local machine using the Enterprise Library for database access and exception logging. This all works fine on my machine but not on my server. I get the following error and i do not know why. Tracing to LogSource 'General' failed. Processing for other sources will continue. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks. I do not see any errors in the configuration. I can get it to log to a flat file but not to the event log or an email it is to send. This is on a Windows Server 2008. Is there any special permissions I need to set? I hope this is the correct place to post a message such as this, if not let me know where to post it to.
View 2 RepliesWe are thinking about using the enterprise library caching framework in our asp.net 3.5 application to store small datatables of our most hit products. Is there a way to write an outside process, like a console application, to remove these datatables, if needed? For example, a client can come in and update the data for a product, which will make the datatable stored in cache out of date. When this happens, I would like an outside application go into the cache and remove or even update the cache with the new data.
View 1 RepliesWe have a custom web app built using Ektron v8.0 which uses EL 3.1 and the format template in the logging config is configured as such:
<add
name="Text Formatter"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Extended Properties: {dictionary({key} - {value}
)}"
/>
Is there a template item for Request URL? Without the request url with querystring parameters, it's difficult to debug errors.