I'm updating my Windows Phone App to Mango and starting to use SQL Server CE. I can insert and select data but am struggling to understand how to update data.
Most of the examples are basic tutorials and only show inserting and retrieving data not updating. I believe I need to attach a class I have retrieved to the data context but that is as far as I have got.
Please can someone point me to an online tutorial showing how to do this. Or some example code would be great.
Thanks.
UPDATE
Basic updating looks fairly simple - query the database, update the object, call SubmitChanges.
My scenario is a little more complicated.
I have a page showing a list of jobs. A job (JobDetail) is selected and another page is used to edit the details. The job is written to a cache (another table JobCache) while the job is edited. If the user cancels the edit the cache is deleted. If the user saves the edit the JobCache object is pulled from the cache, converted to an object of type JobDetail and now I want to update the database with the new JobDetail object.I don't think I can just call SubmitChanges as the object was not generated from a query. I believe I need to somehow use Attach to do this. The question is how?
Why not get the original JobDetail object, update the changed properties from the cahced object and call SubmitChanges ?
Related
Strange enough that I have to ask such a simple question.
I started automating with UFT and I suppose the correct way to check if for instance my login has worked is to add a checkpoint on the next page.
But how do I do that?
All info I get from google is on how to add an already existing checkpoint to may page. But I don't have any.
Here is how I go about automating:
I add manually the relevant objects to the object repository
I create parameters for my action
I create the code that does the steps on the page
one action per page seems to be fine for me
But in the Object Repository of UFT 14.53, there is no button to add a Checkpoint.
A workaround for me would be to just add another Object and check it's existence and forget about checkpoints. Until I hopefully get an answer here, I will try to do just that.
In UFT there are typically two ways to verify that things are working as expected.
Flow (implicit) - In order to verify that progress in the application is successful (e.g. login) one usually just keeps working with the app, assuming that if the previous step failed, the objects needed for the next steps won't exist and the test will fail due to ObjectNotFound errors
State (explicit) - In order to see that objects have a specific state, checkpoints are usually used. Checkpoints are typically added during a record session, I'm not sure if there's a way to add them directly to the repository. An alternative to checkpoints, which works better with keyword driven testing (no recording), is to use the built in CheckProperty method.
i have upgraded our application to SWF 2 and have implemented FMPC pattern. majority of our existing flow definitions doesn't have end-state, now using FMPC as described here, you can trigger commit by putting commit=true to your end-state. Example of our flow:
get form object
save details to db (we want to commit here)
fetch the same object with refreshed data
display to view
its currently working with previous SWF and just using Open Session in View pattern. but we imlemented FMPC to avoid any LazyInitializationException. Now what's happening is steps 1-4 is happening except that changes are not committed, so in the view, we don't see any changes. it seems difficult to add end-state at the middle just to commit to DB and also this means we need to add so many end-state, so my question is how to tell (SWF/FMPC) to commit "programmaticaly" without having to add the end-state tag. If you know better approach, please tell also. Thanks!
Spring Web Flows can have inheritance, so you can implement the end-state in your parent flow and then have it as a parent for all your flows.
I resolved my issue. I finally found out that indeed Hibernate is auto-committing all my read-write operations. The problem is when refreshing the object concerned which gave me the impression that there is no read-write done while in fact there is. Doing sessioFactory.refresh(object) instead of plain find() effectively fetched the updated data from the DB. I guess its because the hibernate session is still alive (due to FMPC) that's why doing "find" will retrieve from the hibernate cache while "refresh" means re-reading the data directly from underlying database. Please correct my analysis as necessary.
Can I configure an alert when a TFS Label is created ? I don't find that option in the current predefined alerts. These are the ones I found:
And I want when a label is created:
Send an email notification.
No, this is not possible using the standard Alert features.
I created my own solution! I don't know how much access you have to your on-premise TFS instance, but you need to be able to execute t-sql scripts against the TFS mssql database. My solution is here: https://github.com/Antebios/tfs-label-notification
And when anyone creates a TFSVC label I get an email alert that looks like this:
Basically, I created a database trigger to populate a table. I query that table and send an email out, then mark the label as sent. I also have a trigger to delete form that table just in case the label gets deleted. I wrote the service in .NET Core just in case anyone wants to convert it to run within a container. Let me know if this helps or not.
Im trying to create a very basic Todo-entity from the Breeze example.. Im doing:
manager.createEntity("Todo",{Description:"Test",Id:32,IsDone:false});
But I keep getting an error where the console tells me that it couldnt find the Type "Todo".. I have tried all types I can possibly think of..
Could anyone please provide me with an example of how to create an entity for the breeze WebApiSample.. cause this is driving me nuts..
Thanks alot!
Breeze needs metadata in order to create an entity of any type. That metadata can either be returned from the server or created locally. My guess is that you haven't yet done either of these. Metadata from the server is usually automatically fetched by Breeze during its first query against the server. Alternatively you can cause it to be fetched directly via the MetadataStore.fetchMetadata method.
Hope this helps.
I don't know why but MagicalRecord delete my store every time I reboot the application, I saw in the documentation :
When using the default sqlite data store with the DEBUG flag set, if you change your model without creating a new model version, Magical Record will delete the old store and create a new one automatically. No more uninstall/reinstall every time you make a change! (see magicalRecord github page
Removed the DEBUG flag,Tried to create a new model version, MR is still deleting my store...
Help me please :-)
This may be a bug. Please add an issue to the github repo. Or, if you need to get going faster, you can peek into the code, and comment out the line that checks to see if your model is compatible with your persistent store.