Architecture :: Create A Constants Mapping Of Strings From Database?
Dec 8, 2010
I have a database table that contains list of all UserTypes(constant strings) used in the application.
What is the best way to store(what datastructure do I need) these so that code can access them ?
The need is similar to enum, but I want to associate these values to those in DB so that there will not be 2 places to edit in case of adding/removing an entry.
one other option I considered is using public static readonly string, but how to associate with those values in DB ?
View 3 Replies
Similar Messages:
Jun 30, 2010
Is there a way to create a file of constants in JavaScript, which I can reference and then use?
What I am looking for is something like this:
Constants.js:
var Phones =
{
Nokia: 1,
Samsung: 2
}
Then, in another JavaScript file JS2.js access those values:
JS2.js:
alert(Phones.Nokia);
And then, in an aspx file that uses them, reference both of them, like:
<asp:ScriptReference Path="../js/JS2.js" />
<asp:ScriptReference Path="../js/Constants.js" />
Is such an architecture possible? What datatypes can we use? I only exemplified enums because this is what i use right now, but they must be declared in the same file as they are used.
View 2 Replies
Mar 8, 2010
It is possible to create a constant like this:
[URL]
<%@ Page CompilerOptions="/d:QUUX" %>
How to create multiple constants ?
View 1 Replies
Oct 2, 2010
I want to create small ecommerce site with sign up and log in pages. there are two categories jeans and T- shirt
I want to create category pages and product pages but I dont understand how to form tables in database means exactly how
many tables required for this application and how all tables are connected to each other ( how to make relationship in tables)
when particular user sign in and select particular pages how it will added in his cart.
View 1 Replies
Aug 17, 2010
Im pretty new to NUnit and am beginning the process of setting up my tests. Some of these test involve a database, specifically checking a particular value against a value in a database and if its not greater than the last retrieved value, flag an error. Whats the best way to test in this scenario ? should I write one value to a database then create another value thats out of sequence and run a database query ? This would involve putting a known value into the table, then running the query with another value.
There is no rollback attribute for nunit, so I gues using TransactionScope would work, that way I could return the database to a known state after the test. There tables have foreign keys so that means adding a lot of extra 'dummy' data first to some of the other tables. Is this sort of 'testing' the best way ? I basically need to perform the test based on an existing data value and I guess this must be pretty standard stuff, so whats the best way ?
As I understand it, the tests should be self contained, so any data i insert into the database during the test should be removed afterwards, is this correct ? If so, it means I need to insert test data into 6 additional tables just to test one function, then remove it after the test has completed, is this the normal way to to this ?
View 2 Replies
Jan 20, 2011
I am using the Visual Studio 2010 Express to create a web site.I created a database using SQL Express,but I decided to copy the mdf file to App_Data folder thinking I then might not need SQL Server running.I used the connection string that points to the database file in App_Data.
I deployed it to the server (Windows 2000 server with .Net 2.0 and SQL Server 2000) using Copy Web Site.I got the following error.An error has occurred while establishing a connection to the server.When connecting to SQL Server 2005,this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.(provider: SQL Network Interfaces,error: 26 - Error Locating Server/Instance Specified)
My questions are
1. Do I still need SQL Server running even if I used a database in App_Data?
2. On the server SQL Server 2000 is running,why does the error say SQL Server 2005?
3. Are there anything that I have to consider beyond the version of Framework when deploying after development with VS 2010 (Framework 4.0)?
View 2 Replies
Sep 29, 2010
I have an ASP.NET project which is pretty n-tier, by namespace, but I need to separate into three projects: Data Layer, Middle Tier and Front End.I am doing this because...
A) It seems the right thing to do, and
B) I am having all sorts of problems running unit tests for ASP.NET hosted assemblies.
Anyway, my question is, where do you keep your config info?Right now, for example, my middle tier classes (which uses Linq to SQL) automatically pull their connection string information from the web.config when instantiating a new data context.If my data layer is in another project can/should it be using the web.config for configuration info?If so, how will a unit test, (typically in a separate assembly) provide soch configuration info?
View 3 Replies
Feb 5, 2011
Could anyone provide me more info regarding this subject because I'm clueless. Any link, tutorial or anything else would be appreciated. The problem is I don't know where to start, but what I have to do is to import data from Access database to very similar SQL database.
View 1 Replies
Feb 17, 2010
Can I create dynamic routes instead of mapping them manually in MVC?
I have this incoming url request having more than 5 routes and possible in random orders.
www.websitename.com/sports/winner-today/track-order/player-1/player-2/player-3/player-4/player-5/player-6
In global.asax, I do this...
routes.MapRoute( _
"SportsTrackWinner", _
"sports/winner-today/track-order/player-1/player-2/player-3/player-4/player-5/player-6", _
New With {.controller = "SportsTrackWinner", .action = "Index"} _
)
But, my website has different track winners for a specific day, like,
www.websitename.com/sports/winner-today/track-order/player-2/player-1/player-3/player-4/player-6/player-5
Now imagine the probability of random winners and the number of mapping rules I have to create in global.asax. [:(]
I try using catchall parameters, like
routes.MapRoute( _
"SportsTrackWinner", _
"sports/winner-today/track-order/{*players}", _
New With {.controller = "SportsTrackWinner", .action = "Index"} _
)
But it can't capture any querystring value pass at Controller parameters.
View 3 Replies
Aug 10, 2010
I am try to create architecture design for WCF service.
We have WCF service that we have to expose to third party so then can request with xml and get back xml response.
The wcf service should do the following:
- Accept the request call with xml
- Check xml against the schema
- Parse the xml
- Authenticate the incoming xml by username and password that will be in xml
- Send back the response
If anybody can let me know what kind of design I can use or is there any pattern available that I can take it and then extend it as per my requirement.
View 2 Replies
Feb 14, 2011
There is a way to map a tree view to a database structure?
View 7 Replies
Mar 10, 2011
I trying to write a javascript generate <%= element.ClientID% > where element is one of the input parameter of function. I am trying to write a variable
var elementName = "<%=" + element + ".clientID%>"
which is giving an error
CS0117: 'string' does not contain a definition for 'clientID'
View 2 Replies
Sep 2, 2010
As I began writing web applications with asp.net I started with small projects that used a Linq-To-SQL mapper for database access to a MSSQL Server. After gaining some expierence I switched into a classic 3 tier with Graphic Layer, Business Layer, Data Layer. The only function of the Data Layer was to provide methods insert/update/delete without any logic and logic the form of selection methods.
Over the time I realized that it would be better not to provide the database classes up to the GUI (took some time unfortunately). I switched into using Business classes in the BL that are used for all operations performed by the BL and display by the GUI in the form of getting List from the BL. A great advantage is that I can provide additional properties that are not represented by the database itself. However, I did that mapping inside the BL myself with methods that mapped the corresponding BL class to the database class.
I guess thats where O/R mapper come in handy? Until now I haven't realized their purpose, but I think I just found it. I've recently tried out using the new Entity Framework with .net framework 4, but I'm only using it like the Linq-To-SQL DataContext.
Is there a way to achieve the mapping automatically? If yes, is that something the new Entity Framework provides or do I need to look for a O/R Mapper like NHibernate?
View 4 Replies
Oct 6, 2010
how to find User Mapping option of any database in sql server 2008.
so that i can change the DB_OWNER name to AdMINISTRATOR.
View 1 Replies
Mar 29, 2011
I was tasked to create 3 tier web application. However, i browsed through many books & tutorials. The examples are doing it using Object data source which my lecturers claimed that it is not 3 tier at all. Shouldn't be dragging any data source into deisgn view. Any comprehensive examples for me to take reference from?
View 4 Replies
Sep 16, 2010
structure of 3-tier architrcture
View 7 Replies
Jun 18, 2010
Strings pulled from a database formatting issues:
These are pulled from fields in a Database and the results are listed below.
This:recognized as a "Woman in Science" at
Turns into this:recognized as a “Woman in Science” at
This:recently received 2 NIH Director's Awards
Turns into this:recently received 2 NIH Director’s Awards
This:- Director of Communications at acme Communications, Inc
Turns into this:• Director of Communications at acme Communications, Inc.
note:This seems to be not happen when using <ul>
<li> but when it is just enclosed in a <div></div> it
shows the • instead of bullet.How can I fix the display of these strings? This is using C# as the language.
View 7 Replies
Apr 2, 2010
Using MVC 2 and VS 2010 RC.I have a varchar database column set to NOT NULL and I use the Entity Framework to bind the column to a textbox. I want a user to be able to leave the textbox blank and have an empty string inserted into the database column. However, MVC is trying to set the property to null during the Create postback, which causes ModelState.IsValid to be false and subsequently the validation UI is triggered with the message "The value '' is invalid".Here is the model:
[Code]....
The controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Candidate c )
{
if (ModelState.IsValid) // This is false when the textbox is left blank.
[code]...
View 3 Replies
Sep 20, 2010
I am trying to convert some strings fetched from database into 'Title case' however it is not working for records like 'JAMES Smith'. The output is all the same.
TextInfo companyName = new CultureInfo("en-US", false).TextInfo;
if(!myRecord.IsDBNull(myRecord.GetOrdinal("GENCLIENTNAME")))
{
myCompany.GenClientName =companyName.ToTitleCase(myRecord.GetString(myRecord.GetOrdinal("GENCLIENTNAME")));
}
View 2 Replies
Dec 31, 2010
I wonder what is the best place to store the enums I should use like constants in my n-tiers Application.
So I have an application with a DAL(connect to database), a BLL(Business processes), a Data Transfert object "Layer" (classes without any methods but just fields, this one is reacheable by all the others) and the interface layer with the asp pages.
My question is : I have a enum:
[code]....
Where can I put this enum(and all the others) to be clean? Not in the Data Access Layer the Interface layer will not see the struct, not in the Business Logic Layer, this is not really business.. Maybe in the Data Transfert Object but is it really a "Transfert object"?
View 7 Replies
Oct 22, 2010
How can i use the .net Default folder App_GlobalResources Folder to store a Resource file which contains all the Page names?
Currently i added a a Resource file (PageNameConstants.resx) and set the name filed and Value field but i cannot access any of those by calling
App_GlobalResources.PageNameConstants.HOME(HOME has the value ~/Home.aspx)
View 1 Replies
May 31, 2013
I am doing an AJAX call back to a WebMethod but in the code behind webmethod I cannot use any of the constants at the to of my form. What I want is to gain access to sessions and my sql connection string.
View 12 Replies
Mar 23, 2010
On UI Ajax calendar control is used to allow the user Expiry Date as shown below. As this is one of the controls in search, when the Search button is pressed using SQL statement (copied below) data is retrieved from ExpiryDate column of the table. The table creator declared the column type as string and the dates are saved as single digits(Example: 2/2/10 sometimes and sometime as double digits (Example: 02/02/10) I like to know the best practice in retrieving both type of strings from database table. Calendar control
[Code]....
SQL(part of stored proc)
[Code]....
with in button click event stored procedure is called to return search results.
View 7 Replies
Apr 13, 2010
I am having serious performances issues with gridview + tabs. Its very slow.. I was thinking to create a XML based logical layer between my database and UI.
1) Will it be useful if i use webservice to get data from database to poppulate gridview?
2) or Use xml + some service (need advice on it)
View 3 Replies
Nov 24, 2010
I have a third party dll and i need to add some more functionalities (methods, constants etc..) so create a wrapper class. I have no idea about wrapper classes. what is the purpose of this and how to create in .NET for this 3rd party dll.
View 6 Replies