BenHayat wrote@Support;
As I'm considering two situations (One using SP and another using ASP.Net Entity Framework) to use tables that created were by AwareIM System.
Both tools (SP & ASP.Net) will CREATE New records & UPDATE existing records (and perhaps DELETE as well).
My concern & questions are as following.
Could you PLEASE give us official guidelines what to do and what not to do to make sure we do not disrupt Aware's system? Also other points that I'm not listing below.
==> One of the concerns when CREATING records is that aware does not use identity fields, but instead, it has a table (BAS_IDGEN) with one row, and one column (MAX_ID) that has the last number used. It does not matter if 2 different tables have the same ID, but, obviously you can't have 2 rows in the same table. Therefore, either make sure you lock, update this field then unlock it if you are using it to create the ID field, or perhaps the ID field is something your external app will create that will not "bump" into aware's numbering.
a) As Aware creates and populates certain columns that act as foreign keys in table relationships, could you please give us the rules how we should populate them when using outside tools like SP or ASP EF?
==> Foreign keys are easy to handle, even though it is a little strange compared to other systems that have the database do all the work. Assume you have a customer and order BO, and in the order BO, you have a relationship to customers called "OB_Customers" . There will be 3 columns created in the Orders BO (and NONE in the Customers BO even though it LOOKS like it when you look at the attributes in Aware. They are named "OB_Customers_REN, OB_Customers_RID, and OB_Customers_RMA. The "RID" has the ID of the parent table (just like foreign keys in SQL). the other 2 have constants. The "_REN" is the NAME of the parent BO, so in this case its "Customers". If, when creating the relationship you said also create it in the parent, then this is the NAME of that attribute. In this example, it would be "OM_Orders". if you didn't select that option, then this is a null. Therefore, when inserting rows with foreign keys, you just add these constants. (or, in SQL, create a default so every time a record is added, SQL does that)
b) When UPDATING existing records with outside tools, how do we perform proper record locking and/or recognize if data is being locked by Aware system at any moment and if there are DIRTY records (since Aware is in the middle of updating) that we should not touch. How should (in SP or EF) check if a record is dirty and is in the middle of update by Aware?
And in reverse condition, how do we flag a record in outside tools that a record is being changed so Aware can understand it's a dirty record?
==> Simple answer is you DON'T. If its possible that another user will be updating one of the rows you are updating, then do not do it. You will end up with inconsistent data. Creating rows is very seldom an issue, (i.e. if I am working with a customer and entering an order, no problem. However, if another user could also be working with that customer, then I might run into a problem. And remember, any records updated, created or deleted outside of aware will NOT trigger any aware rules, so, for instance, if you have a column in the customer file with TotalOrdered and it has a rule to recompute it when an order is entered, you will have to do that calculation in your external program.
c) What else should we keep into considerations (What to do or not to do) to make sure other tools stay in cooperation with Aware at runtime and do not affect data that is currently in CONTEXT. This is my biggest concern, data that is in CONTEXT and hasn't been saved from other users.
==> Context should not be an issue if you are the only one who is changing a record. Yes, aware will not know that you did that, but for the times it makes sense to do this externally (i.e. having some complex logic called when creating / updating tables, it should be rare that others are updating (reading is no problem) the same data.
As much as I find lots of benefits in being able to alter data outside of Aware, It also makes me nervous to do so, to disrupt Aware's data System.
Aware's CONTEXT is a complex and intelligent system that monitors many things between data residing in DB and data being changed/added/deleted within server. CONTEXT being that central hub/junction is one of the most important parts of Aware. When we touch data outside of Aware, we LOSE this CONTEXT (Data manager) layer. To me, this is why I don't like to touch data...
So the BIG question is, can we use SP UNDER the supervision of Aware's CONTEXT, so we're not stepping on CONTEXT toes? This where I'm scared to mess with data while Aware's CONTEXT is not aware of it.
Thank you in advance!