TFS - auto increment number field in a WITT (e.g. Bug's) - tfs

Is there a way to auto increment a number field in a WITT (e.g. Bug). We've got a requirement that we want contiguous Bug ids (note - not its actual id but a separate field).
Can this field be done unique per collection OR unique per project (thus duplicates would occur in the collection).
---edit
I've no idea how to tackle this, but I'm wondering if I could use a globalist, e.g. bug creation triggers the adding (replacement) of a value to the list?

There is no way to do this directly through the WIT platform. You would need to write some sort of custom service to do this for you on the creation of a new bug.

My answer goes into the same direction like aaronbjorks one.
Create a webservice that gets alerted if a new bug is created, then just write down the bug ID in a database with an identity column. On the workitem you can create a custom control, that gets the identity for that bug from the database and displays it somewhere.

A possible workaround would be exporting your items query to Excel and let it update the IDs upon Publish. Make sure once an ID was assigned, tag it as FROZEN.

Related

Best approach to get count of workitems state transitions?

I need to create a dashboard widget for Azure DevOps that shows number of work items of a specified type, that transitioned from one state to another.
It looks like the Updates endpoint is my best bet, but that means that I would have to iterate over all of the updates of workitems for the specified type and then determine if it contains the state transition I'm looking for, e.g. Closed to Open.
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/updates/list?view=azure-devops-server-rest-5.0
The Analytics extension looked promising, but it looks like I would need to query the Revisions dataset, and that doesn't contain the old and new values.
https://learn.microsoft.com/en-us/azure/devops/report/extend-analytics/wit-analytics?view=azure-devops
The use case is to show the number of bugs that were closed then reopened in the last 90 days. I thought that I would make the work item type and from and to states configurable.
Any ideas or suggestions much appreciated!
Best approach to get count of workitems state transitions?
At this moment, we could not query the History with State changed from one state to another state on Web UI directly.
As workaround, we could add a custom field in our custom process that gets set the value to true when workitems state change from Closed to New:
Then add a Rules to set the value of the custom field to True if the workitems state change from Closed to New:
Finally, we could query the workitems with following conditions:
BTW, if you want to get those workitems which state already changed from Closed to New before use above custom filed and rules, I am afraid you have to use Rest API to query the work items that in specified type:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/wiql/query%20by%20wiql
Then loop the work items list to get all revisions for every work item with Revision - List API:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/revisions/list
There is a article for TFS TFS SDK: Work Item History Visualizer using TFS API, you can check it for some more details.
Hope this helps.
You may do it through PowerBI. Calculate time-in-state for an existing Analytics view
Or as you said iterate over all of the updates of workitems.

Possible to select a specific entity without knowing the key in OData?

I have a problem where I need to select a specific value from a specific entity from a entity set, however, I need to do it in a way without knowing the key.
This is the query I actually need:
odata/..../picklistLabels(locale='en_GB',optionId=10819)/label
However I need to program it in a way so it automatically selects the label without knowing the optionId. Is there a way to do this in OData?
From your question, I think that you want to perform a navigation but you don't have a key. Unfortunately, this exact functionality isn't available, however, you can perform an expand like this:
odata/..../picklistLabels?$filter=locale eq 'en_GB' and optionId=10819&$expand=label
This will get you the same information that the other call would do but in a slightly different format, you would have to find the first element in the array and then get the label property to get that information
As an aside, if you have the option to change the server (I'm guessing not due to the sapui5 tag but it might be useful for other users) you could change the key. If the locale and the optionId are enough to identify the object, then you could make these into a composite key. Here is a link for an example within the WebAPI OData source code: https://github.com/OData/ODataSamples/tree/master/WebApi/v4/ODataCompositeKeySample

oracle devart entity framework - added New column - now trigger system_id not changing to a unique new number?

oracle 10.4
devart dotConnect - 6.50...
MVC2 project - web page
User fills out form, then controller gets new entity, fills it out. saves database
System_id before saving = 0 (its an int/number - so no cannot be null)
Several other tables linked, so they have their own System_id as well.
When it gets saved to database, some trigger (there is a stored trigger for the table, which I only seam to understand as when system_id=null to be fired), a new Number is assigned for System_id.
This all worked fine.
Then I came along, and needed some updates.
Another field needed on this "main" table
(I have earlier, added columns to another table, with out issue)
Added column to this "main" table (restrict_to_me)
Now when it tries to save to database - it trys saving "system_id=0".
Linked tables, also make records with system_id=0
In entity framework designer - i can see the field system_id ENTITY_KEY=true and StoredGeneratedPatern=Idenity
So I can not see what I have done to stop somthing from working with the entity framework, except updating the entity framework.
Any direction much appricated
thanks
When you added the new field, did you drop the table and recreate it?
If you did that then you deleted the trigger at the same time. So when you recreate the table, you also need to recreate the trigger.
Try inserting data just using an SQL statement and see if the id is generated.
This was an Entity Framework issue, one many have already had.
Not every time, but some times, when updating the model, StoredGenereatedPattern being droped in a section.
http://www.ladislavmrnka.com/2011/03/the-bug-in-storegeneratedpattern-fixed-in-vs-2010-sp1/
When looking at fixes, did not understand that BOTH SSDL and CSDL parts stored in same text.
So look in upper part that it has StoredGenereated Pattern.

How to make UPDATE queries in LINQ to SQL?

I like using LINQ to SQL. The only problem is that I don't like the default way of updating tables.
Let's say I have the following table with the following columns:
ID (primary key), value1, value2, value3, value4, value5
When I need to update something I call
UPDATE ... WHERE ID=#id
LINQ to SQL calls
UPDATE ... WHERE ID=#id and value1=#value1 and value2=#value2 and value3=#value3 and value4=#value4 and value5=#value5
I can override this behavior by adding
UpdateCheck=UpdateCheck.Never
to every column, but with every update of the DataContext class with the GUI, this will be erased. Is there any way to tell LINQ to use this way of updating data?
I'm confused by this statement:
but with every update of the DataContext class with the GUI, this will be erased. Is there any way to tell LINQ to use this way of updating data?
By "the GUI", do you mean the Linq to SQL designer? Because the property sheet for each member has an "Update Check" property that you can set to "Never". If you are manually editing the .designer.cs file, don't do that, instead change the Update Check setting in the actual designer.
Designer Screen http://img29.imageshack.us/img29/7912/updatecheckdesigner.png
Please note: The "default way" of updating used by Linq to SQL is called optimistic concurrency, and is a way of preventing conflicting updates from multiple users. If you turn this off by using the method above, you have to be prepared to deal with the fact that if two users have the same record open at the same time, the second user's changes will overwrite the first user's changes without any warning or confirmation. Be sure that this is the behaviour you really want.
Unfortunately, no, there's not. You have to edit the DBML manually after it is generated (or updated) - which is a pain (or use the Designer as already mentioned in the other answer).
When I last used L2S on a project, I wrote a quick utility which ran post-generation and fixed it up, but it's an unnecessary pain which (c)shouldn't be required IMHO.
Ran into this one myself. The trick is to change the way one generates the DBML--such as using l2st4. Then you can set that pesky UpdateCheck property to always be never by modifying the template.
That is how Linq works. Why don't you like this update behavior?
Read about optimistic concurrency
http://msdn.microsoft.com/en-us/library/bb399373.aspx

Ria Services - SubmitChanges() problem. Possible to limit to one change at a time?

I would like to submit a collection of entities one at a time.
There are 2 reasons for this:
- I'm uploading a lot of data and submitting more than one change exceeds the http limit for these transfers. (i don't want to change this limit)
- I want to see the progress of each item getting submitted.
Example: Suppose I have an album and each album has a collection of photos (entities).
If the user adds some photos, I want to upload one photo at a time and not the whole chunk at once.
If you'd like to Submit one change at a time, simply call SubmitChanges upon committing an edit, or adding or deleting an entity...
Typically in your UI if you have some sort of commit button, then tie that to do two things - both the local commit, and subsequent SubmitChanges.
Note you can also override ValidateChangeSet on your DomainService to ensure there is only one operation in the ChangeSet. This ensures clients don't inadvertently try to commit more than one change at a time...
SubmitChanges() will submit the changes in a changeset (all that have changed since you loaded it). I don't know how to modify it's behavior, but you could write your own update method in the service and pass in the object you want to update
Check out the riaservicesoverviewpreview.pdf at http://code.msdn.microsoft.com/RiaServices around page 50 for some info about the update.
Edit: I found this method yesterday while trying to do the same thing with WPF: link text. I used the idea of detaching and then attaching the entity (I'm using a single static global DataContext).

Resources