Data Access Layer - From Wiki
Data Access Layer - From Wiki
Able Gold has examples for the data access layer (Affiliates) in the wiki: http://wiki.ablecommerce.com/index.php/ ... _-_AC_Gold
I can't find these Affiliate files anywhere in the project, so I'm assuming they are in the core CommerceBuilder libraries.
Where are we supposed to put our classes and NHibernate mapping files for custom tables?
If we need/want to add a custom field to an existing table, how do we go about doing that?
I can't find these Affiliate files anywhere in the project, so I'm assuming they are in the core CommerceBuilder libraries.
Where are we supposed to put our classes and NHibernate mapping files for custom tables?
If we need/want to add a custom field to an existing table, how do we go about doing that?
Re: Data Access Layer - From Wiki
You need to put your custom classes and mappings in Class Library Project. If you want to extend an existing table and expose the field in existing AbleCommerce object then you will need to make change to class and HBM file within CommerceBuilder. Have a look at this thread viewtopic.php?f=65&t=17586 where new database tables and nhibernate is discussed.
Re: Data Access Layer - From Wiki
I presume I need to purchase the CommerceBuilder source code then?If you want to extend an existing table and expose the field in existing AbleCommerce object then you will need to make change to class and HBM file within CommerceBuilder
Is there anything that isn't included/customize-able in the source code package?
If you buy the source code package, do you release updates for the source at the same time as the store/website so we can keep things up to date?
- Shopping Cart Admin
- AbleCommerce Admin
- Posts: 3055
- Joined: Mon Dec 01, 2003 8:41 pm
- Location: Vancouver, WA
- Contact:
Re: Data Access Layer - From Wiki
I do believe so, but Mazhar can confirm.I presume I need to purchase the CommerceBuilder source code then?
NoIs there anything that isn't included/customize-able in the source code package?
Yes, it's typically released the same day as a normal release. The builds are automated.If you buy the source code package, do you release updates for the source at the same time as the store/website so we can keep things up to date?
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Data Access Layer - From Wiki
I didn't have to modify Able's source code when I did what I explained in the link mazhar posted. I did that code using a custom table. If you want to add properties to one of Able's objects you would need the source code, but there are ways around that so you don't need the source code. You can do like Able does with the subcategory listing on a couple of the category page- make a new kind of object right on the page. They do something similar on the conlibs they use to display product items within a category page- they turn a product into something called Item.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Data Access Layer - From Wiki
Thanks, will look into it.
Re: Data Access Layer - From Wiki
Judy, I just took a look at the CategoryGridPage and to see if I could find what you were talking about. I found SubCategoryData, but that is kind of different because SubCategoryData isn't persisting anything to the database; it is basically being used as a View Model for the SubCategoryRepeater.
Be cool if there was a Settings or CustomFields property on all the entities that could be populated when the main object loaded (as opposed to lazy load and firing a query on demand). Hardly anybody would need access to the source then.
Be cool if there was a Settings or CustomFields property on all the entities that could be populated when the main object loaded (as opposed to lazy load and firing a query on demand). Hardly anybody would need access to the source then.
Re: Data Access Layer - From Wiki
This is easy to accomplish (indirectly) using the CustomField class. However you wouldn't want child objects queried on every load of the parent object - that would slam the SQL server unnecessarily and potentially slow the whole site down.sweeperq wrote:Be cool if there was a Settings or CustomFields property on all the entities that could be populated when the main object loaded (as opposed to lazy load and firing a query on demand). Hardly anybody would need access to the source then.
Let's say you have a category with ID 288 and want to store a custom field with it called 'Explosive'.
To persist a custom field, do this:
Code: Select all
CustomField newField = new CustomField();
newField.FieldName = "Explosive";
newField.FieldValue = "Yes";
newField.ForeignKeyId = 288;
newField.TableName = "ac_Categories";
AbleContext.Current.Database.BeginTransaction();
newField.Save();
AbleContext.Current.Database.CommitTransaction();
Code: Select all
IList<CustomField> customFields = NHibernateHelper.CreateCriteria<CustomField>()
.Add(Restrictions.Eq("TableName", "ac_Categories"))
.Add(Restrictions.Eq("FieldName", "Explosive"))
.Add(Restrictions.Eq("ForeignKeyId", categoryId))
.List<CustomField>();
if (customFields.Count > 0)
{
string fieldValue = customFields[0].FieldValue;
}
Gets much easier once you build a helper class to handle the heaving lifting above.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com