WCF / ASMX :: Singleton Object - Leave Business / Data Layers In Main Solution
Jan 13, 2011
I have an ASP.NET 4.0 site that I expect to come under extremely high volumes in the next month or so and I am attempting to maximize performance. The site is divided into the front end UI pages, as was as a business and data layer. My thought was to pull the business and data layer out and wrap them in a NamedPipes Connected Windows Service running in Singleton mode.
I created the windows service, got the connection setup correctly and now I am wondering if this is just asking for trouble. Is this a good idea or should I just leave the Business/Data layers in the main solution and let IIS spin those objects up and down for each request? In essence I was thinking that using a WCF Windows Service as an Application Server would be more efficient but that is just a theory
View 1 Replies
Similar Messages:
Mar 14, 2010
How do I make ObjectDataSource work with singleton Business object? My singleton business object is defined in Global:
[Code]....
I get an error:The type specified in the TypeName property of ObjectDataSource 'objThreads' could not be found.
View 2 Replies
Jun 30, 2010
I'm fairly new to .NET development so I might be missing something very simple here. I'm trying to set up a web service as a data item so that I can bind it to a control on my page. I was reading some tutorials about doing this in an earlier version which seemed very simple. All you had to do was add the web reference, create a data source and use the object type, pick the web service and enter the name of the call that would retrieve the data.
In 2008 the object data source type doesn't seem to be available anymore when creating a new item unde app_data. I get options for SQL Server, XML and XML schema. I've tried adding an existing source and picking each of the files generated for my web service reference, with no success. I suspect that I have to use one of the XML options, though at this point my web service is a simple thing that only returns some strings for prototyping purposes (I'm not the one writing the web service, just the front ends. Our other developer hasn't come up with a stub service yet). I know there must be some way to set a web service up as a business object so that you can bind it to a control like a gridview.
View 2 Replies
Dec 20, 2010
I'm a junior programmer, i do not get the concept of MVC! My method of coding is seperating my application design into 3 layers:
Presentation Layer
Business Layer
Data Access Layer
I find it very practical to a junior developer or at least to me, so i do not really get the point of MVC since i believe MVC just tries to separate logic from UI. Right?
I decided to have this book to help me have a better idea on code design:
http://www.amazon.com/Professional-ASP-NET-Design-Patterns-Millett/dp/0470292784/ref=sr_1_1?ie=UTF8&qid=1292836936&sr=8-1
Note: i also decided to start learning about TDD.
QUESTION:
Is breaking my code design into 3 layers (presentation, dal and business) meets MVC concept?
View 4 Replies
Jun 17, 2010
Again, I am new to the ASP.NET world, and I come from a Windows Forms background. I'm working with an ObjectDataSource that retrieves a collection of business objects. With the collection, I am going to be binding it to a CheckBoxList and other various controls. The business object that I am using is an Employee.
To get all of the employees, I create an ObjectDataSource and set the "Select" method. I then set the DataSourceID of the CheckBoxList to be that of the ObjectDataSource. When I load the page for the first time, I see all of the employees. Now, the user goes through this page and selects all the employees they want to see information about (by checking the box next to the employee name). Finally, the user hits the button called "Display." Upon postback how do I get a list of those employees? I've tried the following solution, but I'm not sure if it's the best practice in obtaining all those employees again. Here's my solution...
In the CheckBoxList, I set the DataTextField to the Employee's name. I also set the CheckBoxList's DataValueField. This property is a little different. I set this to be a UNIQUE IDENTIFIER, which can distinguish this employee from other employees. Now, when the user hits the button "Display" I use my ObjectDataSource again and MANUALLY call ObjectDataSource.Select(). I cast the returned value as a List<Employee>. Finally, I iterate through all list items in the CheckBoxList...
[Code]....
If the item is selected, I parse through my list of employees that was returned from the bjectDataSource.Select(). I use the item.Value and compare it to each employee's "key." If the key is found, I know that the employee is selected. I put this employee in another list called EmployeesSelected.
Finally, I take EmployeesSelected (which is a List) and set my GridView's .DataSource and call .DataBind() on the GridView.
Is this the "best practice" of re-obtaining the Employees that are selected on my page, or am I making this too complicated?
View 1 Replies
Jul 22, 2010
I have set the instanceContextMode to single to create a singleton class.I use the join to add a user to the list, and getuserlist() to retrieve the users. I added a service reference opened two browsers , made sure i simulated it such that i am adding two seperate users , and display the users returned by getuserlist. But its always displaying only one user , the current user. I also have a counter
private static int counter = 1
public int returnCounter()
{
return counter++;
}
This is returning incremented values when i open it in different browsers , but the list is always getting overritten. I am running this as a managed windows service, wsHttpBinding , and my client is a website accessing this service.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
View 1 Replies
May 23, 2010
I have a lot of Singleton implementation in asp.net application and want to move my application to IIS Web Garden environment for some performance reasons.
CMIIW, moving to IIS Web Garden with n worker process, there will be one singleton object created in each worker process, which make it not a single object anymore because n > 1.
can I make all those singleton objects, singleton again in IIS Web Garden?
View 1 Replies
Jan 19, 2010
I have a VS 2008 solution with 16 projects (1 web site and 15 class libraries. The website uses the assemblies). This all worked fine on Win XP pro.
My work PC just got upgraded to Windows vista business and i'm receiving the following error each time i build the project.
Could not load file or assembly 'xxx, Version=1.0.1363.21887, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
I went on and signed all the assemblies and added them to the GAC. But i keep having this error when i build my project. I'm running vs 2008 as administrator.
View 4 Replies
Dec 1, 2010
I am creating a singleton object in the first request to the web service and keeping it in the memory. This works fine for first few seconds. If I make a request 5 minutes later, I can see that the singleton object is created again? is my singleton object getting disposed after x no of minutes? how can i make increase the life-time of my object forever ?
public sealed class Singleton
{
static ServerInstance instance = null;
static readonly object padlock = new object();
Singleton() {
}
public static ServerInstance Instance {
get {
lock (padlock) {
if (instance == null) {
instance = new ServerInstance();
}
return instance;
}
}
}
~Singleton()
{
#if DEBUG
ExceptionFactory.Fatal("~Singleton() called!");
#endif
}
}
[WebMethod]
public string OnReceiveEvent(string objectXmlData, string objectType) {
if (!Singleton.Instance.initServerComplete) {
InitServer();
}
return Singleton.Instance.OnReceiveEvent(objectXmlData, objectType);
}
public void InitServer() {
if (!Singleton.Instance.initServerComplete) {
Singleton.Instance.InitServer();
Singleton.Instance.initServerComplete = true;
GC.KeepAlive(Singleton.Instance);
}
}
View 2 Replies
May 29, 2010
I do not know how to create a business object for inserting data into the database.
View 2 Replies
Mar 27, 2010
which one is better in "Session Facade Class" and "Singleton Object" design patterns in ASP.Net? Also, please state the scenarions where specific design pattern is advisable to use.
View 1 Replies
Sep 15, 2010
In ASP.NET Webforms have an ASP.NET GridView connected to a C# class via an object data source
I have an ID set up as a DataKeyName in the grid. How do I pass this to the C# class when I update the grid?
View 15 Replies
Jan 21, 2011
In ASP.NET Webforms have an ASP.NET GridView connected to a C# class via an object data source
I have an ID set up as a DataKeyName in the grid. How do I pass this to the C# class when I update the grid?
View 2 Replies
Jun 2, 2010
If I run below ASP.NET code, it gives me same output in different post-backs. First Time
Name is = Smith
also After Post-back (Button Click)
Name is = Smith
I feel though I have defined singleton, it should return a new object every time in different ASP.NET post-backs. because once the function "PAGE_LOAD" is completed then there are no reference variables holding singleton object. So there is a change of unloading the singleton class from memory by CLR. that means there is a chance of losing private static reference variable and also single ton object stored. In ASP.NET stateless environment, why is it keeping earlier object in multiple post backs and btw, without having any reference variable to that object. Is this is known danger with singleton in ASP.NET environment?
[Code]....
View 4 Replies
Nov 14, 2013
This is My Method, How to get Checkbox Value from Gridview and adde that value inti list?
private List<ActivityList> PopulateData() {
string ActivityCode = string.Empty;
string ActivityName = string.Empty;
List<ActivityList> list = (List<ActivityList>)Session["ActivityToStudent"];
List<ActivityList> listObj = (List<ActivityList>)Session["ActivityToStudent"];
for (int j = 0; j < listObj.Count; j++)
[Code] ....
View 1 Replies
Mar 26, 2010
I created a class library: PRTreatmentReviews. I created a reference for the class library on the website. I checked the property pages and the reference to the class is there. I put objectdatasource on a page and tried to pick up the PRTreatmentReviews class but it's not there? The Class
[Code]....
View 13 Replies
Jan 7, 2011
I want to put my website project and admin website under same project as I want to use session and authentication of the main site. Also I want to show the admin, the page, where he has made changes. But the problem is whenever I will change anything in admin pages, I've to build the entire website. I don't want to do that. Can I build that separately?
I don't want to choose the option of building all pages separately as well.
Is there any alternatives of doing that. Separate projects for admin and website will come up with many other challenges. So I would like to avoid that.
View 2 Replies
May 11, 2010
I am working on Vs2005 and asp.net 2.0. I have a solution with 4 projects (business object, components, data access, webclient)When I change any existing method or property in Business object or data access, it is not reflecting in the application. I have deleted the existing references to the project and added them after the new build. I always get errors like "method not found or No overload method "It seems like old verion of dll is still there in the reference.
View 7 Replies
Feb 18, 2010
I have a DetailsView (DV) control, an ObjectDataSource (ODS) control, and a button on a page. I have 2 classes in the App_Code directory (Customer and CustomerDAO). The DAO class provides static methods for the ODS control and simply hack values in (ie...no real database selects/updates). The Customer class has 2 properties (Id and Name) and a default constructor. The page takes an ID on the querystring and determines if the DV control is in insert or edit mode. If in edit mode, it sets the SelectParameter on the ODS (id field), calls ODS.Select(), and then calls DV.DataBind(). The existing (although fake) customer is loaded and display properly when this happens. I then change the name of the Customer in the DV and click the Button to save the new data.
Everything seems to be wired up correctly as the UpdateMethod that is specified in the ODS control is called and succeeds (even in my real example with my database). The problem is that the BoundFields in the DV control have not been updated with the new values and therefore the existing values are updated in the database and my changes are lost. I have handled the OnUpdating event of the ODS and the values are still the old values. I have also handled the OnItemUpdating event of the DV control and the NewValues IOrderedDictionary still has the old values in it also. In looking at the MSDN article for the UpdateMethod, it states the following:
Parameter Merging
Parameters are added to the UpdateParameters collection from three sources:
From the data-bound control, at run time.
From the UpdateParameters element, declaratively.
From the Updating event handler, programmatically.
I am using the BoundField classes in my DV control so I would have assumed that the first bullet above would have handled the updating of values, but it doesn't appear to work with the way I am doing it. If I set the values explicitly in the OnUpdating event that is fired by the ODS control (the 3rd bullet) the right values are updated (again...even in my real database situation). It seems like my only issue is that the automatic binding that I expect from the DV control isn't working as I would expect it to. Here is the code that I have in my fake example:
[Code]....
View 7 Replies
Apr 5, 2010
I am having 2 solutions:
[1] [URL] (this is a dnn website which contains a web service to be consumed in "xyz" website).
[2] [URL] (this is an asp.net website which consumes web service defined in "abc" website). That means this website is having "Web Reference" folder which contains .wsdl, .disco and .discomap types of files.
Problem is - when I see these files (.disco, .discomap and .wsdl etc files under Web Reference folder), they all are having urls defined like [URL]. That means its fix to "abc" virtual directory ?
What if end user or customer wants to purchase my application but want to have some other name like [URL] (the virtual directory to someother name).
In that case; I assume that I need to "MANUALLY" find [URL] and replace to [URL] ?
OR is there any alternate solution for that?
View 1 Replies
Jul 20, 2010
I have two webservices that affect the same system (one webservice points to the development environment and the other points to the production environment). There's any method to configure my application to change the webservice that I am working with, without needing to change the namespace used in my classes? I use an enum that's defined inside theReference.cs file of the webservice, so in any place that I need to use a call to that webservice I need to include it's namespace, taking in consideration that the enum type is used as argument for all function calls of the webservice.
View 2 Replies
Mar 24, 2010
How to set Height and ItemSource(Business Object as DataSource for Cell) for every Cell in DataGrid/ Grid? Shown below is part of code I am currently using with Grid Control. What I am currently doing is that I am using ListBoxItem, set Item Height and ItemSource at ListBoxItem Level, Add ListBoxitem to ListBox and then Add ListBox to Grid, It leaves me with just one row and multiple columns in the Grid, which is perhaps not the best way of doing it as it doesn't allow me to take benefits from UI Virtualization of Grid.
[code]....
I am open to use any control i.e. Grid/ DataGrid provided it allows me to set Cell Height and item source at Cell level. In my requirement, Cell height depends on the Item duration and size of image, which means the height of the cells may not be same across cells in any particular row.
View 3 Replies
May 30, 2010
I have a business object that looks like this:
[Code]....
What is the value of SomeId after I create an instance of my object? I was testing it with SomeId == 0 but it wasn't working. Then I tried null which gives me an error.
What is the right way to handle this? Am I to assign an initial value to my objects' properties in the object? If not, how do check if my object has any values assigned to its properties -- in particular, int values?
View 8 Replies
Jul 7, 2010
I just have a need where I have to select only selected attributes/fields of a very large business object. I ended up designing a DTO and a collection class for that DTO. Few questions.Is there any difference between a DTO and a dumb business object ? I filled the DTO inside the DAL and loaded it inside a DTO list and now returning to Business Logic layer but it seems its the same like dumb business objects to me (with only less attributes)
View 3 Replies
Jan 7, 2011
I create a database with more than 10 tables, how can I automatically generate business object class inside asp.net C# project?
I hope that one expert can give me steps for how to do that?
View 3 Replies