7.0.4 Database Access Layer
-
- Lieutenant (LT)
- Posts: 78
- Joined: Wed Mar 05, 2008 11:27 am
7.0.4 Database Access Layer
I understand that 7.0.4 no longer uses Enterprise Library for its data access layer. What is it using instead and is there any documentation on it? I want to add an extra field to the product table and have it edited in the admin sections. I was able to do this previously with older versions with mixed results. I had to do a lot of extra work to get around the fact that ENTLIB only updates a record if it detects changes in a particular field. Since my field is foreign, in that it isn't managed at the DAL layer, it wouldn't write out the record. I had to fool it into thinking one of its fields were changed. Has this changed at all?
Re: 7.0.4 Database Access Layer
Documentation: Data Access Layer (the AbleCommerce Wiki has quite a bit of documentation you may find useful)
Re: 7.0.4 Database Access Layer
I've used this and it works great:
viewtopic.php?f=47&t=12056
I added a field to the Products table and used this DAL to access/modify
the field I used with the above:
viewtopic.php?f=47&t=12056
I added a field to the Products table and used this DAL to access/modify
the field I used with the above:
Code: Select all
string query = string.Empty;
if (chk_Engraving.Checked)
{
query = "UPDATE ac_Products SET Engraving = 1 WHERE ProductID = " + Request.QueryString["ProductId"] + ";
IF EXISTS (SELECT ProductId FROM ac_ProductProductTemplates WHERE ProductId = " + Request.QueryString["ProductId"] + " AND ProductTemplateId = 5) RETURN ELSE INSERT INTO ac_ProductProductTemplates (ProductId, ProductTemplateId) VALUES (" + Request.QueryString["ProductId"] + ", 5)";
}
else
{
query = "UPDATE ac_Products SET Engraving = 0 WHERE ProductID = " + Request.QueryString["ProductId"] + "; DELETE FROM ac_ProductProductTemplates WHERE ProductID = " + Request.QueryString["ProductId"] + " AND ProductTemplateId = 5";
}
CommerceBuilder.Data.Database database = Token.Instance.Database;
System.Data.Common.DbCommand updateCommand = database.GetSqlStringCommand(query);
//int result = (int)database.ExecuteNonQuery(updateCommand);
database.ExecuteNonQuery(updateCommand);
Re: 7.0.4 Database Access Layer
If you simply want to add new field for product then I second the Mike's idea of making of using product custom fields. There is another helpful have a look at that as well
viewtopic.php?f=44&t=9088
viewtopic.php?f=44&t=9088