Architecture :: Accessing A Different Class Depending On The Database Type?
Mar 25, 2010
I need to make a webservice in .net (I know how this works) but then I need to get data out of a database. But my company wants to make it in a way that you can use the system with multiple databases.
So my option was make multiple abstract classes which contains the folowing code (depending on the database type, this would be a SQL database)
public abstract class AbstractDAO<T, Tid>
View 5 Replies
Similar Messages:
Dec 1, 2010
I am working on a website where when the user logs in, I select their database based on their username. Currently I have a list of all databases in the web.config and I select the Database ID from the username and then read the database string from web.config. What is the most optimal way to implement this scenario?
currently I:
- store the Database ID in the session object
- the Session object expires after like 5 minutes so i have to read the Database ID from the online database based on the username and regenerate the Session["DatabaseID"] again.
- there are some security issues with the Session ID, so I started clearing the Session in !(Page.IsPostBack) and I generate the Database string again.
Where shall I store the DatabaseID and the database connection string so I can easily reuse it once the user has logged in?
View 8 Replies
Dec 10, 2010
i have the following code:
[Code]....
I was trying to implement as above. How can i call this class from the code behind of my page, and call the methods Open and Close connection ?
How do i instantiate the object ?
View 5 Replies
Jan 14, 2010
I'm writing an application that will be accessed by different groups of users. I have one aspnetdb for logon; then depending on which group a user belongs to, I want to point them at a different 'content' database. Each user wants similar information, but unique to each group, so the schema of each database will be the same, but the content will be different. We're probably talking a dozen or so groups here.
What's the best way to achieve this? Would roles do? I could put each user into a specific role, group1, group2 etc, then check which role a user was in and use a connectionstring in the web.config file based on that. This seems like it would work, but it seems a bit of a cludge. A dozen or so connection strings doesn't seem too much of a problem, but it doesnt' really seem the correct use for roles.
View 7 Replies
Jan 3, 2011
my controller, I'm generically deserializing Xml. The object being deserialized to could end up being any number of different types. This, of course, won't be known at compile time. I've created a number of partial views, each of which are strongly typed to a different object that is a possible outcome of the Xml deserializaton.My problem is that I'm struggling with a good way to return the right view. I could always switch on some property in the object, or use a Key/ViewName Dictionary mapping to get the right view name, but I was hoping for something a little more generic than that.Does anyone know of a way that I could implicitly say, "return the view that is typed off of the object I have."?
View 1 Replies
May 16, 2010
I have asp:Table with number of asp:Label inside asp:FormView, it represents short stats info.I need to set Label.CssClass to "red" if it's text isn't "0".Currently I do this on FormView.DataBound event. But think that it's better to use JavaScript and probably jQuery. How can I do that?
View 1 Replies
Jan 26, 2010
[code]....
I am going to return an Object depending on the Class and Year params. I want to remove the where condition when the Class and Year parames are null or zero.
View 2 Replies
Jun 11, 2010
Iam building a website and i need to store somehow some informations that i will use in the whole site depending of the user type logged in.
Example:
1) User XPTO logs in
2) Query DataBase to see where he belongs
3) Store those 2 or 3 fields that i will get in Database in a persistent way to use it in the whole site.
Whats the best practices to do this?
View 4 Replies
Jun 11, 2010
I´m building a website and i need to store somehow some informations that i will use in the whole site depending of the user type logged in.3) Store those 2 or 3 fields that i will get in Database in a persistent way to use it in the whole site.My question is: Whats the best practices to do this?
View 1 Replies
Jul 6, 2010
I am going to have multiple "types" of an object and I am really not sure how best to retrieve/save those multiple types without having a separate save/retrieve for each type.
My classes:
[Code]....
I hope this makes sense. I'd rather not add a "type" column as I have this in another part of my database and I am not really liking it too much
UPDATE
Here's more info/questions for clarification, if necessary.
I'm really at a loss for how to incorporate them into my repository pattern.
When I call getEvaluation, I want it to return an abstract Evaluation, but I'm struggling with this code. Same with Saving - any insight on this would be excellent
UPDATE 2
Database:
Evaluations
Id (PK)
Comment
EvaluationType1
Id (FK to Evaluations.Id)
Field
EvaluationType1
Id (FK to Evaluations.Id)
Field
So, in getEvaluation(int id), I need to figure out what type of Evaluation they want. Does this mean I should pass in a type? Same is true in saveEvaluation, But I can do a switch/function map to see what Type it is.
View 6 Replies
Jun 14, 2010
I am looking for a way to integrate a web application with a client application that will sit on the users desktop. Our scenario looks like this user will click a link in the client server application that will launch an .ASPX and pass various parameters via a querystring. User will make form inputs on ASPX page and on that input, I need to be able to execute a .EXE on the client machine that will refresh the window in the client server application.
I have looked at some tutorials for using ActiveX for this, but they all seem out of date and the ones that I have been able run prompt the user with the Activex warning dialog, which I would like to avoid.
View 4 Replies
Dec 3, 2010
we have an web site access on PRODTEST Environment . We are facing an issue site works fine when we try to access the site using the Individual Server names (with Ip address).
View 2 Replies
Nov 14, 2010
I've created 2 multi dimensional arrays (2 dimensions each), I want to feed them both into a function, and I would like the function to spit out an array or list containing both of them as arrays, so I can use them as they were before they went into the function.
The way I've done it at the moment is probably very inifficient and I'm having trouble accessing it properly.
What follows is my attempt to put the 2 arrays (attackerarmy and defenderarmy) into a new array called armyresults and adding an additional dimension to tell me if the record belongs to the attacker or defender:
[Code]....
Since I've already got the 2 arrays I want in the function, I've rather not inefficiently force them into a new array, only to try to re build them again when they come out of the function.
how to out 2 arrays of unknown size into an array of arrays for the return statement of my function, and then how I can access those individual arrays so I can easily copy them back out into their original form?
View 1 Replies
Sep 8, 2010
I'm developing a web application in asp.net using C# and need to access the command prompt of the server computer.
After accessing it I need to run a "ABC.bat" file in the server computer which is in folder "E:Test".
The absolute path of the server is "\MyServer"
PS: I need to run the ABC.bat file on the server machine as the bat file runs couple of more applications which are licensed to that server machine.
View 7 Replies
Jan 7, 2011
I have a webform set up in such a way that it reads in a query string from the URL and uses that to adjust its LinqDataSource to accordingly display the relevant (specific) post.
So for example if someone does:
[URL]
They'll get the full post whose ID equals 4 displayed in front of them. Here is my current setup:
Default.aspx >> All Posts Listed Here
Details.aspx >> No Posts Displayed Here
Details.aspx?post={postID of type Integer} >> the post with that specific post ID will be displayed.
I want a user to click the title of a post on { Default.aspx } and be redirected to { Details.aspx?post=X } where X = the postID. Here is the code I have:
[Code]....
I am getting an error saying: The name Container does not exist in the current context.
View 13 Replies
Nov 24, 2010
I want to access the functions defined in ADO.vb file in my Default.aspx.vb file. note that the ADO.vb file is in the root directory. I can access it if it is in the App_Code directory. It it is in the root directory how can i access that?
View 9 Replies
Aug 11, 2010
I'm iterating through a collection of asp:tablerows to be able to get or set the text in a textbox that is nested in the third cell of the row; I'm doing this by type rather than by ID because the cell ID's in that column aren't totally consistent--thus I can't really call FindControl() to achieve this. I've resorted to casting the third control in the TableRow to a TableCell and then Casting the first control in that cell to a TextBox. Not quite correct, as I'm getting an index out of range exception thrown. The problem mainly lies in the Controls.Count() property of the third cell, which comes to zero. Not sure if there's a better way to access the textbox---should I resort to FindControl()?
foreach (TableRow row in tblProviders.Rows) {
string value = ((TextBox)((TableCell)row.Controls(2)).Controls(0)).Text;
...
}
My searches here only yielded use of FindControl(), so that may be the only way...
View 2 Replies
Mar 15, 2011
So i have some existing functionality from an older ASP.Net app that is a static class.
Say there's a static method in that class that returns a dataset that I would like to bind to something like a gridview or whatever I can build using MVC3.
View 2 Replies
Apr 15, 2010
I am unsure of how to reference the properties of my class in a function. Here is how I see it in my head, but how do i go about this?
WebService.vb
[Code]....
UserClasses.vb
[Code]....
View 4 Replies
Feb 3, 2011
I have a block of SQL statements that I like to use as a sort of function.
I was thinking that I could make a class and inherit all of the master function, then add the parts that I need for other sections of the program in a sub class.
The problem is, up to this point I've been programming ASP .Net through visual studio, and it's kind of just programming behind controls. I'm not sure where to put the class/function/method/interface, or whatever we call it.
Of course you probably know that visual studio creates a bunch of partial classes when you do an ASP. Net application... so.. to get access to a function like object, across classes.. use an Interface?
View 7 Replies
Jul 1, 2010
While working on my FTP server, I am trying to access a class within my App_Code, but it is not working.When writing, the class is accessible/usable in the code like shown in picture. I get no build errors.But when I run it in the browser, I get an error stating that it cannot find my class.I've looked around some other posts on the forum, like using namespace, but it didn't work.
View 8 Replies
Mar 29, 2010
I am using VB.Net/ASP.Net 2008/3.5 to create a Web Application and I am trying to access the Profile Class.
I notice that unlike a "Website" that you cannot access the Profile class from a "Web Application" and I was wondering what is the best way of adding the Profile class to a Web application?
View 4 Replies
Jun 9, 2010
I set up various global parameters in Global.asax, as such:
Application["PagePolicies"] = "~/Lab/Policies.aspx";
Application["PageShare"] = "/Share.aspx";
Application["FileSearchQueries"] = Server.MapPath("~/Resources/SearchQueries.xml");
I have no problem accessing these variables form .ascx.cs or .aspx.cs file -- ie. files that are part of the Web content. However, I can't seem to access 'Application' from basic class objects (ie. standalone .cs files). I read somewhere to use a slight variations in .cs files, as follows, but it always comes throws an exception when in use:
String file = (String)System.Web.HttpContext.Current.Application["FileSearchQueries"];
View 1 Replies
May 17, 2010
I need to be able to access simple page controls like a textbox from my page class. So if I have a simple aspx page with a textbox on it, I'm trying to do something like this. i'm not using codebehind btw:
[Code]....
I thought maybe I could pass a reference to the page into the class, something like:
[Code]....
But that's not working either. How can I access page controls from my class?
View 5 Replies
Nov 12, 2010
Currently, I am accessing the property by creating a static method like the one below.
public static class CartCollection : List<Cart>
{
public static void Add(Cart Cart)
[code]...
View 3 Replies