DataSource Controls :: How To Use 1 Database Connection In A Unit Of Work Initiated From The UI
May 4, 2010
I am designing a web application and have separate layers for UI, BAL, DAL and DB, while using custom business objects and collections. The app will be used by over 10,000 + registered used and it becoming more complex as I add new functionality such as inline editing and batch processing of collections with transactions ... which has me up late at night trying to design the best approach for this ...In some UI web forms, I bind say 3 controls to 3 different collections. The UI calls the BAL classes for the required collections, then binds the collection returned. So for each collection I want, a db connection is opened and closed. As I understand database connectivity adds overhead so Is there anyway I can design this so 1 database connection is created for a unit of work in a 3-tier or n-tier architecture?
View 7 Replies
Similar Messages:
Jan 22, 2010
Creating a system with web front end and SQL backend (microsoft obviously). I have tried using the asp.netsqlprovider but i can;t as i am only allowed one database on the server, so i then tried to update my current database with the triggers to input the schema into the already existing database.Next step i create my own table with two simple fields of username and password and try and authenticate that way, i can't get that to work either.
I ahve limited permissions on the network as i am a University Student. I really don't know what to do. Never had to create a log on system before and i thought it would be far simpler than this. I ahve used Microsoft's sqlprovider schema before and it worked fine. I have also authenticated via IIS and AD too before. I can't do any of those two in this instance it seems.I need an alternative for logging in users, if needs be in can be crude. I also still need to have some kind of two different views too for logged in users and not logged in users, but that can change if needs must.Don't let me down people, haha. Think this posts in the correct place, i could not find another one i thought could be more relevant.
View 4 Replies
Apr 1, 2010
I'm having a problem, which I haven't had with other projects, in setting up membership. I have set up a aspnetdb database using the asp.net confirguration tool. The database is in the app data folder and I can set up users and roles etc from the web site administration tool. However, trying to log in within the application, using the login control I get "Login attempt was not successful".
I have noted the following :-
1. On the home page of the Web site administration tool the application:/ shows no application where as normally it would show the name of the application.
2. Clicking the AspNetSqlProvider test button, I get the error "could not establish a connection to the database"
3. Although various lines have been added to the web config file, no connection string has been created to the aspnetdb file in the app data folder.
4. If you right click on the aspnetdb file within the solution explorer, there is an option of "include in project". Selecting this doesn't however solve the problem.
View 2 Replies
Jun 11, 2010
I'm trying to weigh up which is the better most reliable database connection for use on a vb.net/ms sql site. I've previously experienced problems catching and closing db connections with the using statement if an error occurs, but do like the fact it doesn't need to use any global variables. Both examples use a general Database class file which opens and closes a connection.my current examples are: TRY CATCH EXAMPLE:
[Code]....
[Code]....
View 1 Replies
Aug 16, 2010
I try to connect my database for so long so i wrote two type of codes. Let's discuse first on.
I have database called PhoneDirectory.
It have only one table named Residents.
I have button wiht ID="Button1".
I want when i click this button to see all of my residents.
I want to see the result in DetailsView and to be able to edin, delete and add new resident.
First try with SqlDataSource so i wrote this:
<asp:SqlDataSource ID="Resident Details" runat="server" ProviderName="System.Data.SqlClient" ConnectionStrings="<%$ ConnectionStrings:ThisIsTheConnection%>"
View 57 Replies
Feb 4, 2010
My website is working but when I host it up, the connection are all screw up. Is it because my connectionString are all linked via SqlDatasource and is for local files only? Whats the coding that I need to put in so that my site will connect to the database via accessing the web.config or server?
View 11 Replies
Sep 10, 2010
How do we convert, the following code to query a SQL database with ASP using a DSN-less connection
[Code]....
View 2 Replies
Mar 23, 2010
Is it mandatory to close database connection in enterprise library 4.1?
View 1 Replies
Jun 14, 2010
am writing a series of WSS/MOSS webparts amongst which one will need to detect the current SQL Server database connection, prompt the user to setup a new connectionstring, and fire appropriate stored procedures to create a new database if needed. The user needs to be presented a textbox or label control with the current database connection. I've never had to detect current database connection, what methods do I call for this? If the desirable connection is not present, the web application needs to prompt the user to make a new database. The user really won't make the database, they simply need to click the command button which will fire the stored procedure to create the database.
View 1 Replies
Jun 5, 2010
First off, I am just getting started with ASP.NET so I expect this is something that I am doing.
i am trying to make a connection to a MS SQL database on my local machine.
I have the following in web.config
[code]....
View 4 Replies
Jun 15, 2010
I'm using an ODBC connection to connect a SQL 2005 database to my ASP.NET app in Visual Web Developer Express. I'm finding that the expected functionality that tutorials review does not work for ODBC connected databases the same way as it does for SQL databases created in the Web Developer. For example, I can't use stored procedures because the option to create one is disabled in the Web Developer, and if I create the stored procedure in SQL Server Management Studio Express, it doesn't show up in Web Developer because Web Developer only finds the system stored procedures, not the user-defined ones. I've seen other cases as well where database management options in Web Developer don't work with ODBC databases.
Am I missing something in my setup, or is there an inherent limitation with ODBC connected databases? Or, is this a limitation with using the Express versions of these development tools?
View 2 Replies
Jan 24, 2010
whether *.mdf database file work if host it in my domain. and also give me any free asp.net hosting site
View 1 Replies
Apr 23, 2010
When I doing unit testing, I suddenlt got error message like:
The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, ublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Operation is not valid due to the current state of the object.
I had this before, to resolve this is to set default run in my testrun.config. After that, I can run unit testings, but I got error :
System.NullReferenceException: Object reference not set to an instance of an object.
The problem is that unit testing cannot initiate DBConnection. Here is my DBconn.vb:
[Code]....
View 4 Replies
Apr 7, 2010
In my DAL i have more than 100 methods/Function, each and every method am opening the sqlconnection and closing the connection, this is taking too much of time to establish the connection at every time. So what i expect is one common class will create the SqlConnection that will check if the connection is Broken or Closed then create the connection again else return the connection, how to do this(Also i would like to apply ConnectionPooling).
View 7 Replies
Jul 23, 2010
I am using VS2008 and oracle 10g ODP.Net. The oracle database that I used in the connection is working and tested it using sql plus.The connection string when used in a GriDView works perfectly. Now when I created a new listview control with the same connection it gives an error.Database schema could not be retrieved for this connection. Please make sure connection settings are correct and the database is online
Object reference not set to an instance of an object at VSDataObjectSupport (478,6)
View 2 Replies
Jan 26, 2011
In an ASP.NET MVC3 environnement with entity framework. Should the Unit of Work point to the service layer or the repository (and then the repository point to the service layer) ?
Ive saw two example:
* One where the unit of work and repository both have an instance to the service layer..
Link: Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable
Doesn't use a service layer but its obvious that one could be use in that case.
* Second where the unit of work have an instance to the repository which have an instance to the service layer..
[URL]
View 16 Replies
Sep 26, 2010
I've been reading recently about EF4, and how to build an architecture for asp.net web forms application using it.
I explored using POCOs (self tracking entities), with WCF, but found out that my application will be deployed on a single box (i.e. one tier), so I started reading about logical separation of layers, and came up with the following solution:
DAL layer that contains EDMX model and EF APIs, and also generated context object.Entities DLL that holds all generated POCO entities using ADO.NET POCO entity generator. (for persistence ignorance, and decoupling entities from DAL).Business layer that contains a façade for each related group of business functions, the façade will be aware of and using DAL layer. And in each function, it will initiate context and uses different entities to carry out specific job (i.e. function).UI layer that only calls the business layer façade classes. With no awareness of DAL, but it will be aware of entities (i.e. using entities DLL), as the business layer will return results basically as entity collections.
I want to know what you think about this architecture.
I also read about an architecture that uses repository and unit of work patterns, but what I understand that context object is already implementing a UOF pattern, and also object sets are implementing repository pattern (correct me if I'm wrong), so the only advantage of using additional abstraction over them is to make the business layer communicates to my classes, not EF classes, and this is good only if the DAL strategy might change (i.e. by using another tool other than EF, which is not my plan).
View 8 Replies
Mar 7, 2011
I am using unity, entity framework 4 with POCO classes, repository pattern for DAL and services for Business Logic control.I also want to use Unit of Work so I can package together CRUD operations which I perform on different services and then commit them all together.My question is what would be the proper way to inject the Unit Of Work mechanism into my application using Microsoft Unity?I understand that I can put the IUnitOfWork together with the repository on the constructor of the proper service and then if Unity mapping is specified it would auto initiate the proper instances, but this way I do not pass the global unit of work but rather create a new instance on each level, which can't be a smart way to do it (actually the repository is initiated even before the service).
private IUnitOfWork _uow;
/// <summary>
/// Returns the active object context
/// </summary>
private ObjectContext ObjectContext
[code]...
View 2 Replies
Feb 10, 2012
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$appSettings:ConnString%>" SelectCommand="sql query ............."
This is in design and with the above I have
SqlDataSource1.SelectCommand = "sql query ............. " in code behind
but if i have the connection in code behind. How do I execute
SqlDataSource1.SelectCommand == "sql query ............. "
It without any reader or dataset...
View 1 Replies
Jul 23, 2010
how to complete my implementation of the Repository pattern in an ASP.NET web application.
At the moment, I have a repository interface per domain class defining methods for e.g. loading and saving instances of that class.
Each repository interface is implemented by a class which does the NHibernate stuff. Castle Windsor sorts out the DI of the class into the interface according to web.config. An example of an implemented class is provided below:
[code].....
As pointed out in a previous thread, the repository class needs to accept an unit of work container (i.e. ISession) rather than instantiating it in every method.
I anticipate that the unit of work container will be created by each aspx page when needed (for example, in a property).
How do I then specify that this unit of work container instance is to be passed into the constructor of StoredWillRepository when Windsor is creating it for me?
View 4 Replies
May 20, 2010
I have several web forms which use a GridView linked to a DataSource control which is defined at design time as follows:
<cc1:pgsqldatasource
id="dsStates"
runat="server"
connectionstring="<%$ ConnectionStrings:PgSqlConnection %>"
oldvaluesparameterformatstring="Original_{0}"
providername="<%$ ConnectionStrings:PgSqlConnection.ProviderName %>" >
</cc1:pgsqldatasource>
As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.
View 1 Replies
Nov 15, 2010
i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:
string path = Server.MapPath("~/uploadaccess/Production.mdb");
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";";
and also
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";");
and tried this
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));
and this is the error i am getting:
Operator '&' cannot be applied to operands of type 'string' and 'string'
View 3 Replies
May 25, 2010
I need to intercept server callback after udate panel async post back and determine which panel initiated the request. The code is pretty simple:
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(InterceptUpdateCallback);
function InterceptUpdateCallback(sender, args)
{
var updatedPanels = args.get_panelsUpdated();
for (idx = 0; idx < updatedPanels.length; idx++) {
if (updatedPanels[idx].id == "myUpdatePanel") {
StartSmth();
break;
}
}
}
And it works when UpdatePanel is not inside another UpdatePanel. But when it is inside another UpdatePanel updatedPanels[idx].id has parent Updatepanel id. So how can I get the id of UpdatePanel which initiated the request (the inner UpdatePanel)?
View 3 Replies
Jul 26, 2010
A user clicks a hyperlink in a page. Server A handles the request and redirects the client to a URL on Server B (more specifically I am using the Response.Redirect method in .NET on server A). I have been asked to restrict access to Server B to redirects originating from Server A only (by blocking IP's other than Server A's). At first I thought this could be achieved by using the HTTP 'referer' header, however, it seems it is up to the browser to set this to a URL (rather than IP), and it is not guaranteed to do so.
I guess there is no way to set the HTTP 'referer' on server A in .NET (to server A's IP)? (my intuition is that would be a security hole). So my question is, how can I restrict access to Server B to redirects originating from Server A?
View 3 Replies
Feb 23, 2010
i have an asp page through which i want to access FTP server And retrieve data (only file properties )from there and get it in excel (or just display it on the browser)is there any way i can keep it simple and acess the data from the server ???
View 1 Replies