02-25-2009 06:25 AM
I created a custom entity, Attendance with TopLine Designer.
I couldn't see how to remove that entity with the product.
So I did this. Ran without error.
private static void DeleteEntity(string p) {
actFwk = GetActFramework();
CustomEntityDescriptor ed = actFwk.CustomEntities.GetCustomEntityDescriptor(p);
FieldDescriptorCollection fds = actFwk.Fields.GetFields(ed);
actFwk.Database.LockDatabase(DatabaseLockReason.SchemaChanges);
foreach (FieldDescriptor fd in fds) {
Console.WriteLine(fd.Name);
if (fd.IsRemovable) {
Console.WriteLine(fd.IsRemovable);
actFwk.Fields.Delete(fd); } }
CustomEntityManager em = actFwk.CustomEntities;
em.DeleteCustomEntity(ed);
actFwk.Database.UnlockDatabase(); }
Now when I try to create a new field with Tools | Create Fields I get this error on Finish.
Invalid object name 'dbo.CUST_Attendance'.
The is Sql Server error.
It appears the sql table function FNB_Attendance that gets Attendances from dbo.CUST_Attendance has not been deleted.
And that function is causing the error. I recall I had the same error with CUST_Policy demo.
04-01-2009 01:05 PM
04-01-2009 01:36 PM
If you are looking to delete an entire custom sub-entity table try:
//Syntax not checked - Taken from other code so may need modification
//Lock Database - Schema Changes ActFwk.Database.LockDatabase(DatabaseLockReason.SchemaChanges); //Initialize Descriptor Act.Framework.CustomEntities.CustomEntityDescriptor attendence = this.ActFwk.CustomEntities.GetCustomEntityDescriptor("ATTENDENCE"); //Delete our CustomTables ActFwk.CustomEntities.DeleteCustomEntity(attendence); //Schema changes made - Unlock Database ActFwk.Database.UnlockDatabase();
It looks like the code in the original post just attempts to delete each field (that can be deleted) in a particular custom table but leaving the table itself.
04-01-2009 03:28 PM
04-01-2009 03:31 PM
Karsmichael,
I would get in communication with the add-on creator for support.
Thanks,
04-01-2009 04:11 PM