Which Pattern Most Closely Matches Scenario Detailed And Is It Good Practice

Mar 6, 2011

I have seen a particular pattern a few times over the last few years. In the UI, each new record (e.g., new customers details) is stored on the form without saving to database. This clearly has been done so not clutter the database or cause unnecessary database hits.

While in the UI state, these objects are identified using a Guid. When these are a saved to the database, their associated Guids are not stored. Instead, they are assigned a database Int as their primary key.

The form can cope with a mixure of retrieved items from the database (using Int) as well as those that have not yet been committed (using Guid).

When inspecting the form (using Firebug) to see which key was used, we found a two part delimited combined key had been used. The first part is a guid (an empty guid if drawn from the database) and the second part is the integer (zero is stored if it is not drawn from the database). As one part of the combined key will always uniquely identify a record, it works rather well.

View 3 Replies


Similar Messages:

Is This Modified C# Singleton Pattern A Good Practice

Feb 9, 2010

I'm developing a blog application shared by non-profit organizations. I want each organization to be able to change their own blog settings. I have taken a singleton pattern (from BlogEngine.net) and modified it. (I understand that it is no longer a singleton pattern.) I have tested this approach and it seems to work fine in a development environment. Is this pattern a good practice? Are there issues, which may arise when this is placed in a production environment?

public class UserBlogSettings
{
private UserBlogSettings()
{
Load();
}
public static UserBlogSettings Instance
{
get
{
string cacheKey = "UserBlogSettings-" + HttpContext.Current.Session["userOrgName"].ToString();
object cacheItem = HttpRuntime.Cache[cacheKey] as UserBlogSettings;
if (cacheItem == null)
{
cacheItem = new UserBlogSettings();
HttpRuntime.Cache.Insert(cacheKey, cacheItem, null, DateTime.Now.AddMinutes(1),
Cache.NoSlidingExpiration);
}
return (UserBlogSettings) cacheItem;
}
}
}

(Portions of code were omitted for brevity.)

View 3 Replies

Security :: What The Best Practice For Next Scenario

Apr 27, 2010

1) All users can browse open web site content.

2) To access memebrs area users must login.

3) Users can create , edit/update, delete there profile/information only.

4) Users can see / view other users profiles.

5) Admin can browse, create, edit/update, delete an any profiles.

I found many different ways to implement it, but what the best practice. May be you can point me in right direction.

Application Web based, MsSQL 2005, .NET 3.5, Server 2003.

View 1 Replies

SQL Server :: Table Design In Sql - Best Practice For This Scenario?

Oct 26, 2010

I want to track equipment between three types of allocations. A piece of equipment can be allocated to an employee, to a customer facility or to a warehouse.

I have an equipment table, employee table, a customer table and warehouse table. Warehouse is where equipment is temporarily held and shared between multiple employees, it is a holding area.

Obviously each equipment item can only be allocated to one employee, customer or warehouse.

My original thinking was to make a table for EquipmentAllocations where it linked the EquipmentID and the id of the employee, customer or warehouse (all guids).

Eventually I will need to query the equipment to see where it is located/allocated. I will also need to query the employees to check what equipment is allocated to them.

I am trying to figure out the best way to handle this and I am looking for some guidance. I am sure many of you have had situations similar to this that you could draw upon to offer up some advice.

View 8 Replies

Good Practice When Retrieving SQL Data?

Jan 19, 2011

I'm currently using the fantastic DorkNozzle 'framework' for building a very basic blog in .NET.My first "self-taught" script is as follows, and is for solely retrieving SQL results.

PHP Code:

<%@ Page Language="C#" MasterPageFile="~/Dorknozzle.master" AutoEventWireup="true" Title="Blog" %>
<%@ Import Namespace = "System.Data.SqlClient" %>
<script runat="server">[code]....

I should change to perhaps improve my coding style, without going down the MVC line just yet?

View 17 Replies

Good Practice To Avoid Using Session State In MVC?

Mar 7, 2011

It's not explicitly written somewhere but I felt so after reading few blogs on ASP.NET MVC. Just got curious and thought of asking it here.

UPDATE: I'm not asking about memory/storage/RAM concerns on server. For them, there is a solution to store session out of process. I know that. I'm curious that, are there any scenarios where we had to use Session in WebForms but we can avoid it now in MVC taking benefit of the nice structured way offered by MVC?

View 6 Replies

C# - Is It A Good Practice To Implement Logic In Properties

May 27, 2010

we use ASP.NET with C# and based on open source projects/articles I passed through, I found many properties were including a logic but when I did so the team-leader told me it's not good at all to place logic inside properties but to call the logic through methods...

View 6 Replies

Good Practice - Connection String In Web.config?

Jun 30, 2010

Whats the difference, if in my web.config i use. both works with my code. what is right way of diong it? keeping connection string?

[code]...

View 4 Replies

C# - Is It A Good Practice To Write HTML Using A StringBuilder In Codebehind

Mar 25, 2010

I'm interested to hear from other developers their opinion on an approach that I typically take. I have a web application, asp.net 2.0, c#.

What I usually do to write out drop downs, tables, input controls, etc. is in the code behind use StringBuilder and write out something like sb.Append("

I don't find myself using to many .net controls as I typically write out the html in the code behind. When I want to use jQuery or call JavaScript I just put that function call in my sb.Append tag like sb.Append("td...onblur='fnCallJS()'.

I've gotten pretty comfortable with this approach. For data access I use EntitySpaces.

I'm just kind of curious if this sort of approach is horribly wrong, ok depending on the context, good, time to learn 3.0, etc. I'm interested in learning and was just looking for some input.

Edit

After reading the comments here it sounds like I should take a look at MVC. I've not done that yet. The only hesitancy in doing so is that the existing project is just that, existing. There is a lot of code already done the way I explained and it is hard to imagine what would be involved in changing it, advantages of doing so, and just learning what that would take.

The other thing I'm taking away from the comments is that my code behind should really not include much of the sb.Append code, whereas now it is filled with it in numerous functions. To me it is not messy but that is because I know what each function does and can look at it and see, oh that writes out x, y, and z.

It's not uncommon for me to just have a div on the .aspx part and then build up the .innerHtml of that with the StringBuilder in the code behind.

View 7 Replies

C# - An ImageMap For A Navigation Menu Considered Good Practice?

Feb 2, 2010

Should I use an ImageMap to create a navigation menu?

View 1 Replies

C# - Best Practice Or Design Pattern For User Registration ?

May 2, 2010

We have a big portal that needs user registration to allow them use its services. It's already done in .NET and SOL Server 2005. we are in the phase now of discovering all the problems of the current registration system to build a new robust flexible one that can be extended easily and can be more usable for all services.

View 3 Replies

Does Anyone Know A Good Practice To Use When Developing For The System.directory Services Class

Jan 31, 2011

I'm trying to create a data access later using System.DirectoryServices. I'd like to use the MVC 2 framework and have all my views be mostly strongly-typed. Does anyone know any good way to this?

For example I started creating a Group Entity:

public class Group
{
public string DistinguishedName { get; set; }
public string GroupName { get; set; }
}

And an abstract interface:

public interface IGroupRepository
{
List<Group> Groups { get; }
}

I am confused about developing the GroupRepository using the system.directory services. Connecting to a SQL database is easy there are examples everywhere but I have no been able to find any using the System.directory sevices in conjunction with a class using MVC. Has anyone tried to do something like this?

View 1 Replies

Architecture :: Good Design Pattern For Forum Development?

Jan 12, 2011

i want to know which design pattern is good for forums web site design

View 5 Replies

C# - Good Practice To Perform Direct Database Access In The Code-behind Of Webpage?

Jun 7, 2010

I am an experienced developer but I am new to web application development. Now I am in charge of developing a new web application and I could really use some input from experienced web developers out there.

I'd like to understand exactly what experienced web developers do in the code-behind pages. At first I thought it was best to have a rule that all the database access and business logic should be performed in classes external to the code-behind pages. My thought was that only logic necessary for the web form would be performed in the code-behind. I still think that all the business logic should be performed in other classes but I'm beginning to think it would be alright if the code-behind had access to the database to query it directly rather than having to call other classes to receive a dataset or collection back.

View 2 Replies

Webforms - Content Management System - What Is The Good Design Pattern

Mar 19, 2010

We are going to develop content Management System in ASP.net. what is the good design pattern do we need to follow in order to have good design.

View 2 Replies

Which Java Web Framework Closely Resembles MVC

Oct 31, 2010

I need to port a ASP.NET MVC app to Java. To make migration easier, I would like to use the most similar Java web framework to ASP.NET MVC.

I know basic Java web development [JSP/Servlets] but I don't any Java MVC framework. What Java web framework would make my migration the easiest?

View 2 Replies

Pattern For Retrieving Complex Object Graphs With Repository Pattern With Entity Framework

Oct 13, 2010

We have an ASP.NET MVC site that uses Entity Framework abstractions with Repository and UnitOfWork patterns. What I'm wondering is how others have implemented navigation of complex object graphs with these patterns. Let me give an example from one of our controllers:

[code]....

It's a registration process and pretty much everything hangs off the POCO class Person. In this case we're caching the person through the registration process. I've now started implementing the latter part of the registration process which requires access to data deeper in the object graph. Specifically DPA data which hangs off Legal inside Country.

The code above is just mapping out the model information into a simpler format for the ViewModel. My question is do you consider this fairly deep navigation of the graph good practice or would you abstract out the retrieval of the objects further down the graph into repositories?

View 2 Replies

MVC :: AsyncController Gripes / Working Pattern For Converting A GET-POST-GET Pattern To Asny?

Feb 23, 2010

Does anyone have a working pattern for converting a GET-POST-GET pattern to asny?

I'm encountering the following issues:

1. You cannot mix Sync and Async action methods SubmitForm(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() ... (because the resolver gets all confused ... it doesn't use the HTTP verb to decide who to target. BTW: I think that's poor design, or a bug)

2. Renaming the get method name to something else eg: SubmitFormConfirmation(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() would be very awkward if it works ... because you have to doctor the <form markup to specify an action name.

3. You cannot give them all async names SubmitFormAsync(), SubmitFormAsync(bool? confirm), submitFormCompleted(), because the call just keeps malfunctioning. It sometime even behaves as if you are requesting a delete of something.

Can someone give an insight from an actually working sample.

View 5 Replies

Best Design Pattern For Associating Subdomain With Area And PRG Pattern?

Aug 21, 2010

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature."there a easy/non tacky way of associating subdomains &#8594; areas?Something like:
[URL]Also, whats the best accepted design pattern in implementing PRG pattern in ASP.NET MVC? I guess it should also get some official loving in MVC 3.

View 2 Replies

Unable To Start Debugging IIS 7.5 Detailed Error - 500.19?

Sep 22, 2010

I tried to run my WebApp on my local machine today (nothing has changed on it) and I had the above error. I know my machine had a windows update recently (not sure if that has anything to do with it).

The error produces a big print out of css styles and html markup.

In the markup it also says "The requested page cannot be accecssed because the related configuration data for the page is invalid".

View 1 Replies

Security :: Research To Accomplish Very Detailed Permission Handling?

Aug 27, 2010

Currently i have membership and roles setup on my site. Now what is my next step to get more specific control.

Based on what i hav now, i have my pages setup so they are visible or not and links not visible and so on. But now on a more detailed level, say im setup as a user. As a user my default permissions is just to view data.. no editing. But say someone was let go, now instead of granting me full access to everything, i need to be able to go in and provide more permissions to the account.

Example:

Admins:
Add Users
Modify Users
Delete Users

Users:
View Users Detail (only the person that is logged in)

Since the the user that was let go was an admin. They had all the other options, but as a temporary thing, we need to be able to add say permission "Add Users" to the individual user account.

To accomplish this type of control, what do i need to look at to accomplish such a setup?

View 3 Replies

Visual Studio :: Detailed Documentation For Toolbox Objects?

Aug 27, 2010

I have been developing application in Visual Web Developer 2008 Express using ASP.Net and Visual Basic. My problem is finding documentation for each of the various toolbox "Standard" objects and the "properties" for these objects. I have manuals that cover some of the more commonly objects but I am hoping that somewhere there is a manual or website(s) that would provide detailed information on all (or most all) of these objects. Does anyone know of a manual or website that provides this information.

View 2 Replies

Detailed Steps To Setup Test Site Using Free SSL Certificate In IIS6?

Mar 12, 2011

provide detailed steps to setup IIS6 could not found good information by googling. Is there free SSL certificates that can be used only to test locally?

View 1 Replies

Detailed Technical Information On The Compilation Process For Aspx Pages And Vs2008?

Jul 24, 2010

I'm looking for detailed technical information on the compilation process for aspx pages and vs2008.Recently I have been learning about controlbuilders and pageparserfilters. I have downloaded some code to clean out extra white spaces in my html in order to make the pages smaller. The code works great, but I don't understand WHY it works. I need to learn more about the page compilation process.

View 1 Replies

Forms Data Controls :: Pass A Value To The 2 Master / Detailed Drop Down Lists?

Oct 5, 2010

using below code, I bind 2 drop down lists.

[Code]....

And using the below code, I pass the content of a cell of GridView selectedRow to those DopDownLists .

[Code]....

But there is an error when I try to change the selected value of ddlCity (Detail)...What shall I do ?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved