Entity Attribute Value (EAV) Vs. XML Column For New Product Attributes?

Mar 21, 2011

I have an existing, mature schema to which we need to add some new Product attributes. For example, we have Products.Flavor, and now need to add new attributes such as Weight, Fragrance, etc. Rather than continue to widen the Products table, I am considering a couple of other options. First is a new Attributes table, which will effectively be a property bag for arbitary attributes, and a ProductsAttributes table to store the mappings (and values) for a particular product's attributes. This is the Entity-Attribute-Value (EAV) pattern, as I've come to understand it. The other option is to add a new column to the Products table called Attributes, which is of type XML. Here, we can arbitrarily add attributes to any product instance without adding new tables.

What are the pros/cons to each approach? I'm using SQL Server 2008 and ASP.NET 4.0.

View 1 Replies


Similar Messages:

Forms Data Controls :: Insert Product Attributes From Database To A Dropdownlist?

Feb 15, 2010

I have a gridview displaying the items in the shoping cart. I want the customer to be able to change the size of the item he or she has chosen to buy. I have therefore added a dropdownlist inside the edititemtemplate. I would like to display all sizes that are available in the database in the dropdownlist, but don't know what the sql-statement would look like.

The database looks something like this:

Item
PK: ItemID
ItemAttribute
PK: ItemAttributeID
FK: ItemID
:AttributeName (Size, color etc)
AttributeValue
PK: AttributeValueID
FK: ItemAttributeID
:AttributeDescription (Small, Large etc)
ShopingCart
PK:ShopingCartID
FK:ItemID
FK:UserID
:ItemSize

The dropdownlist looks like this:

[Code]....

The problem is it's display all the other item's attributes and not what kind of attributes that is left, for example Medium, Large, X-Large. how to implement the sizes into a dropdownlist and the sql-statement looked like this:

[Code]....

View 5 Replies

ADO.NET :: Add New Entity With Attributes And Connect

Dec 26, 2010

is it possible to add a new entity with attributes and connect them and store details in the entity i am usign ms2010

View 1 Replies

Forms Data Controls :: Get User Checked Items And Put With Product Name In The Same Datatable Column?

Jan 11, 2010

i build some shopping cart. I have Datalist that display products from SQL table (id, productName, productPrice) and "Add" button. After the user click the button the product appear in the GridView (im using Session DataTable) until now all fine and work greate! in every product i need to add 2 checkboxlist from SQL tables (its some extra to the product). How can i get the items the user was checked and put them with the product name in the same datatable coloumn? the aspx code:

[Code]....

this is the code behaind:

[Code]....

View 1 Replies

Forms Data Controls :: Taking Attributes From Gridview1 And Inserting It Into GridView2 As Column HeaderText?

Apr 8, 2010

I have a problem here.

I have a Gridview, lets call it GVDistinctDate which displays Distinct Date in one column only. For example: I got 5 rows, and 1 column where the column only display distinct dates such as 02/04/2010 | 03/04/2010 | 04/04/2010 | 05/04/2010 | 06/04/2010 where obviously this dates come from a table in the database.

Now i want to take those dates in GVDistinctDate and assign it to another gridview, lets call it GVReport, as column Header Text. For this GVReport, the first column would be StudentID where a list of studentid will be displayed, and then starting from the second column onwards, where the Header Text would be the dates from GVDistinctDate, will display a Status of absent or present according to the studentID and the corresponding date. How do it get the dates from GVDistinctDate into the column Header Text of GVReport?

AND how do it display the Present or Absent status based on the studentID in column 1 GVReport and the dates on the Header Text? Below are the codes of how i got the distinct date into GVDistinctDate

[Code]....

The code below is for GVReport and the comments are where i tried to put in the dates into the column header text.

[Code]....

There is a problem here: GVReport.Columns(k).HeaderText = headerText
Error:Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

View 7 Replies

Product Name By Passing The Product Barcode?

May 11, 2010

Is there any web service which will return the prouct name by accepting the product barcode input?

View 2 Replies

MVC :: How To Add Maxlength Attribute To MVCContrib Grid Column

Nov 16, 2010

i am working in mvc & using MVCContrib grid to show result in grid format.

I want to add restriction to 1 of the grid columns as not to accept more than 3 characters.

how can i add "maxlength" attribute to MVC Contrib grid column.

Or if any other way

View 1 Replies

Data Controls :: Display Product Names And When Clicked Display Product Details?

May 7, 2015

i am using asp.net webform not asp.net MVC.

i want to make my webforms as single page application

ex: i have a webform for products and the correspoding Product Links

if i click on any products the related details of that product has to be dispaly in the same webform .

i dont want to goto another webfom and dispaly the details of the product.

View 1 Replies

C# - How To Dynamically Retrieve All The Possible Attributes (variable Attributes) Values Of One Of The Xml Node

Aug 10, 2010

I am using the following XML structure

<SERVERS>
<SERVER NAME="A1" ID="1"></SERVER>
<SERVER NAME="A2"></SERVER>
<SERVER NAME="A3" ID="3" Parent="XYZ"></SERVER>
<SERVER NAME="A4" ID="4"></SERVER>
<SERVER NAME="A5" Parent="abc" value="10"></SERVER>
<SERVER NAME="A6"></SERVER>
</SERVERS>

I am accessing this xml file by using LINQ to XML in asp.net by using C#. I am able to access all the attributes of an XML node by explicitly specifying the name of the attribute. I want to write query on this xml file which reads all the attribute values of the xml node (In our example the node is SERVER) dynamically means I want to write the query which can read the read the value of the attribute Name & ID from first node, only name from second row, Name, ID & Parent from the third row , Name & ID from the fourth row, Name, Parent & Value from the fifth row & only Name from the sixth row without modifying the existing code every time. Once I add one of the attribute ( for example if I add the attribute ID in the sixth row ) in the above xml file then I dont need to modify my LINQ to XML query. My query should dynamically fetch the total number of attributes & display their values. Is their any way to do this ?

View 2 Replies

C# - Entity Framework Looking For Wrong Column?

Mar 12, 2011

I'm brand new to the Entity Framework and trying to learn all it can offer. I'm currently working my way through the MVC Music Store tutorial which includes the following code:

[code].....

View 3 Replies

ADO.NET :: Get Last Auto Inserted ID In Identity Column From DB Using Entity Framework?

Mar 25, 2011

I am using below code to get new inserted ID in auto identity column from database.

[code]....

It's working fine when I connect my application with MS Sql, but if I connect with Mysql, it always returns 0 (zero).

Is there any other way to get last inserted ID using Entity Framework?

View 2 Replies

Implications Of Changing Column From Not Null To Nullable In Entity Framework?

Apr 1, 2011

I have to change the username column in my database to nullable, which means everywhere in my code, I now have to check username.HasValue and change references to username to username.Value. Is there anything I can do to avoid having to change all the references to username to username.Value?

View 1 Replies

ADO.NET :: Manually Update Entity Object In .edmx To Reflect A New Column In The DB?

Oct 11, 2010

Is there a way to manually update a single edmx entity to reflect a new column in a SQL db table? If yes, what would be the proper step- by-step procedure?

I prefer not to use the "update model from db" template because this will update all the tables and wipe out all the customizations and name changes I have already made in the EF objects. This seems a bit overkill for a single column change. I went down this route once, and I prefer not to do it again. I do not see any way to actually update a single table from the DB using VS2010 "update from db".

What I have tried to do so far is manually add a new scalar property to the appropriate entity using the edmx designer, and this seems to work OK, but I cannot seem to find a way to map the new property back to the db through the mapping window. Do I have to do this directly through the XML file? Also is this sufficient to ensure the new column is correctly reflected in the edmx, or are there other steps that need to be done?

View 1 Replies

MVC :: How To Use Attribute [Display(Name="")] For Model That Comes From An Entity Data Model

Mar 15, 2011

I am a newbie in mvc3 and i'm wondering how to use attribute like [Display(Name="")] for model that comes from an entity data model that I provide im my "Model" folder in my mvc3 project.

I didn't provide a .cs class for each of my database tables .

other words, I want the controller class render a edit form for me like :

First Name:--- instead of : fName:---

View 9 Replies

Forms Data Controls :: Attribute 'onchange' Is Not A Valid Attribute Of Element 'TextBox'

Mar 31, 2011

<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" onchange="calculate()" runat="server" Text="0"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

I'm getting this error on the above markup: Message 1 Validation (ASP.Net): Attribute 'onchange' is not a valid attribute of element 'TextBox'.

View 2 Replies

Web Forms :: Getting Error / Unrecognized Attribute 'targetFramework'. Note That Attribute Names Are Case-sensitive

Mar 17, 2011

I have a problem with my web site 1stSigBdeAssn.org. I have made no changes to the site but I now get the following error message:

Parser Error Message:

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:

[code]....

View 4 Replies

Entity Framework -Update Entity When Another Entity Is Updated

Jun 30, 2010

I have an EDM, it includes the entities extension and history. My goal is to use history to keep track of all the changes made to extension entity. For example, if extension with ID 223 has its property 'Name_Display' changed - I want the history entity to record this.

I'm using ASP.NET with VB.NET. Where in my code do I put the hook to say, "update the history entity" and what should that hook look like?

View 1 Replies

Web Forms :: Attribute 'Master' Not Valid Attribute Of Element 'Control'

Feb 1, 2011

I created a simple Master Page in Visual Studio 2008:

<%@
Master
Language="VB"
CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>
<!DOCTYPE
html
PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"

and got green underlined 'Master' with two warning messages: 1.Validation (ASP.NET): This attribute name must be followed byan equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match. 2. Validation (ASP.NET): Attribute 'Master' is not a valid attribute of element 'Control'.How I can get rid of the messages?

View 3 Replies

Forms Data Controls :: ListItem Error Message Validation(ASP .Net):Attribute CssClass Is Not A Valid Attribute Of Element ListItem

Sep 17, 2010

I have a tag:

<asp:ListItem
CssClass="LabelCSS">Executive</asp:ListItem>

and I am getting the error message

Validation(ASP .Net):Attribute CssClass is not a valid attribute of element ListItem.

What attribute would I use for Css with ListItem?

View 2 Replies

Configuration :: Unrecognized Attribute "targetFramework" Note That Attribute Names Are Case - Sensitive While Hosting

Nov 29, 2010

i'm trying to host an .net framework4.0 application in IIS7. i got an error while clicking on the manage module in modules .like ("Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. ") .I changed my application poll to .net4.0.I am able to browse my application

</system.serviceModel>
</configuration>

View 5 Replies

Configuration :: Unrecognized Attribute "targetFramework" - Note That Attribute Names Are Case - Sensitive

Oct 20, 2010

I installed Microsoft Visual Studio 2010 Ultimate Trial and converted existing asp.net 2.0 web application and I am getting this error: znrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. It's coming from this section in the web.config which was auto-generated by VS2010 when I converted the project:

<compilation defaultLanguage="c#" debug="false" targetFramework="4.0">
<compilers>
<!--<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs" compilerOptions="/d:DEBUG;TRACE" /></compilers> -->
<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs"/></compilers>
<assemblies>
<add assembly="Microsoft.JScript, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>

View 1 Replies

C# - Retrieve The Name Of The Attribute Dynamically Without Specifying The Name Of The Attribute?

Aug 13, 2010

I am developing asp.net mobile application. I am using LINQ to XML to query XML file. I am using the following query to retrieve the name & value of the query dynamically as follows

var TotalManifolds = from MF in FieldRoot.Element("FIELD-DEFINITION").Element("MANIFOLDS").Elements("MANIFOLD")
join SLT in FieldRoot.Element("FIELD-DEFINITION").Element("SLOTS").Elements("SLOT")
on (string)MF.Attribute("MID") equals (string)SLT.Attribute("PARENT")
select new
{
SlotName = (string)SLT.Attribute("NAME").Value,
SlotValue = (string)SLT.Attribute("NAME").Value
};

In the following statement of above query I want to retrive the name of the attribure dynamically without explicitly specifying the name of the attribute SlotName = (string)SLT.Attribute("NAME").Value Here I am explicitly specifying the name. I want to code which can dynamically retrieve the name of the attribute. I am new to Linq to xml. how this can be done programatically? or can you provide me the link through which I can resolve the above issue ?

View 2 Replies

MVC :: Using Data From Multiple Entity Framework4 Model Entity Objects In MVC2 Controller?

Sep 29, 2010

getting data from multiple Entities models into an MVC controller. Most of the examples I have seen for using EF in an MVC2 app only use a single entitiy.

I have just started using MVC2 in C# using the Entity Framework models (CIOps.model) created from an SQL database. I can create the controller and views using single tables of the model in MVC2, but I just cannot get my head around how to get data from multiple entity tables into the controller (similar to joins in T-SQL). I have included an example below of the controller code that works with a single entity table, tbl_tours (tbl_tour in DB).

Could someone please illustrate how this code would be changed to include additional columns from FK tables in addition to tbl_tours columns. E.g. the clients name from the tbl_clients, the coordinators name from the tbl_employees, and costs from tbl_costs entities? Is it possible to do this directly using the EF model entities/classes that are already created and not use LINQ, POCO, Repositories, etc.? The FK relationships are already in the EF models. I have included the whole controller code, but I just need a few examples of how to join the multiple entities, not rewrite every CRUD function function in the controller. I think this will get me over the hump in using EF in an MVC2 App. Also ignore the fact I am using the home controller, this will change in the application.

[Code]....

View 21 Replies

Cast Exception When Try To Insert Entity In Entity Framework (using Code-f)

Feb 9, 2011

I get an cast exception when i am trying to insert an entity in Entity Framework (using code-first). From this code :

public virtual T Insert(T entity)
{
return Context.Set<T>().Add(entity);
}

The cast exception is like "impossible to cast ...Collection'1(Entity) to type (Entity)" I can't figure out why. I am pretty sure ive done everything right. Post entity

public class Post
{
public long PostId { get; private set; }
public DateTime date { get; set; }
[Required]
public string Subject { get; set; }
public User User { get; set; }
public Category Category { get; set; }
[Required]
public string Body { get; set; }
public virtual ICollection<Tag> Tags { get; private set; }
public Post()
{
Category = new Category();
if (Tags == null)
Tags = new Collection<Tag>();
}................................

View 9 Replies

ADO.NET :: Entity Framework - Entity Stored Procedure Mapping - Can't Update

Feb 10, 2011

I am mapping a stored procedure to an entity by right clicking on the entity (in the .edmx) and selecting "Stored Procedure Mapping." This brings you to a Mapping Details - "Name of Entity" Window that allows you to select the insert, update, and delete stored procedures associated with the Entity. It also maps the stored procedure parameter to the Entity "Property" (Column).

I'm gettin an error "error 2042: Parameter Mapping specified is not valid." The cause of the error is fairly obvious, in the Insert stored procedure that has been selected, a 'CHAR' parameter is being mapped to an Int32 Entity Property. I altered the stored procedure parameter to match the entity, I deleted the stored procedure, readded, and reslected it as the Insert function. I also cleaned, validated, updated model from database. No matter what I do, the parameter list in the mapping details doesn't reflect the change to the stored procedure. It's stuck on a char --> int32 mapping, even though it has been changed, like it's buried deep in meta data some where.

View 2 Replies







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