In VS2017, add new 'ADO.NET Entity Data Model' - visual-studio-2017

In VS2017, add new 'ADO.NET Entity Data Model' process, After selecting the data connection Entity Data Model Wizard gets closed instead of proceeding to next stage(table/sp selection).

Related

Update newly created record on client after successfully processing the Create request on server

Please, consider following scenario:
IgniteUI 16.1 igGrid powered with igGridUpdating feature and RESTDataSource
User creates a new record through modal dialog
Post request is initiated with form data
Server processes the create request and returns an object, populated with correct ID
In success handler on the client side, the newly added in the grid row has to be found and updated with correct ID returned from the server.
The ID column serves as a grid's primary key and it's hidden
What happens when a new row is adding?
We are watching infragistics.lob-16.1.js
In _dialogOpening(), row 68167, _originalValues are computed via $.extend(this._originalValues, values, this._originalValues), where values = _getDefaultValues() or with other words values.id = this._pkVal. And _pkVal is a counter that is incremented each time when a new row appears.
Keeping that in mind, later, _endEditDialog() is called, where newValues, representing the entered data by the user, are merged with default values of the input form: newValues = this._getNewValuesForRow(colElements) followed by newValues = $.extend({}, prevValues, newValues) and prevValues are the same _originalValues from above.
Then an _addRow() is called, which calls on its run grid.dataSource.addRow() and a transaction is created.
My point here is the updating feature generates ID automatically for the new row and ID = CurrentRowsCount + 1.
So, if the grid contains 8 records, then newly created record will automatically be assigned with ID = 9. And imagine, if one of existing records has an ID = 9, then igGridUpdating's updateRow(rowId, values) will update both rows, existing and the new one. And I realy want to call this method in order to update the row with the data, returned from the server.
How could I intervene in the whole picture and accomplish the update of the new row?
The auto-generated primary keys are only meant to cover the most basic scenarios. If your app supports row deletion you should change them with something that will keep them unique using the generatePrimaryKeyValue event.
Using updateRow after receiving the permanent keys from the server is the way to go, however, remember to pop the transaction from the allTransactions array so the update doesn't go to the server on the next saveChanges call.

ember.js ember-data initiale state of new created model record

Ember.data 2.2.0
The state of just created object is dirty (get('hasDirtyAttributes' return true), cause the new ID is set every time.
I need to know when the record is created, not saved and the "user" not modified it. So, I can't use the dirty state cause the store change it.
If I modified the internal state just after create the record, I will broke somthing inner the record?
My real need, is when I create the record I need a initiale state and I want detect when a user change it. So, I saw in the record source code, it's use the "setProperties" methode to set the ID and optionaly the data passed to the createRecord method.
So, I want override the createRecord store metod to set the dirty state to false after created it. And the principal, how I can do that?
I saw the doc of DS.RootState Class and it just talk about that states : (deleted, saved, uncommitted, inFlight, empty, loaded, created, updated, loading) and the method translateTo but nothing to change the dirty state.
In the doc say :
Flags are Boolean values that can be used to introspect a record's
current state in a more user-friendly way than examining its state
path
So... I set currentState.parentState.isDirty to false and that it
Edit: After set the flag directly, the record doesn't change state, stay in no dorty. So, how what I can do?
The only solution I found is test if the object is new. If is it, re-create a new one.
If not, I call the rollbackAttributes().
And use the that method on model for detect a change :
isChanged : function() {
return this._internalModel.hasChangedAttributes();
}

EmberJS client side record management (ember-data)

I have just started trying to use ember-data. I have an ember app for which I need to produce all the data on the client side and then save it all at once. So my object graph has a "Project" as the root object, then a project can have many "Sections" and then each section can have many "Items".
I am up to the stage where I am trying to create Item records on the client side and add them to the correct Section. When I am ready to save the data I just want to use project.save() and have it go and save the object graph instead of saving every time the model changes.
I am trying to look up the section to place the items in by name using store.filter({name:"section1"}) but ember keeps trying to go to the server to look them up. I see this in the console: GET http://localhost:4200/sections?name=Section1 404 (Not Found).
This is what I am trying to do:
store.filter('section', {name:'Section1'}, function(section) {
return section;
}).then(function(section)
{
var record;
//create a record
section.pushObject(record);
});
You are doing server side filtering and you want client side filtering.
Please read this article carefully.
In short, you should do
store.filter('section', function(section) {
return section.get('name') == 'Section1';
});

Why are models from store already updated before model.save is called?

I was testing some behavior in ember.js.
The scenario:
I have a simple model called Team with property name.
I am using the fixures-adapter for the team.
I implemented inline-editing in a list-view. The Textbox-fields are bound to the models property "name".
The Object-Controller handles the SaveEvent. In the SaveEvent i do following:
App.TeamController = Ember.ObjectController.extend({
actions: {
save: function(){
var model = this.get('model');
// alerts changed text from textbox which is bound to the model
alert(this.get("model.name"));
//load unchanged Object from store (before calling save):
var fromStore = this.store.getById('team',2);
// Also alerts the changed content from the text box
alert(fromStore.get("name"));
}
}
});
Why is the alert of this.get("model.name") equals to alert(fromStore.get("name")) without calling model.save()? Between: When I use this.store.find('team',2) and resolve the thenable-result, the behavior is still the same.
How would the code behave, when I would use an own adapter against a web service?
The store only has one copy of a record. So when you fetch it from the store again it's returning the exact same instance to you as you already have.
save persists the record to your server, not persists to the store.
the properties aren't set in stone in the record until you've successfully persisted. You can still do record.rollback() to revert the changes that have occurred.

Check if an item is already in the ember-data store

I am making a lot of async calls and using loadMany to preload the ember data store like this:
if(data.feed.activities.length > 0){
App.store.loadMany(App.Activity, data.feed.activities);
}
Some of my bindings are screwing up if I am readding the same item more than once which is a possibility.
Is there a way of not reloading the item if it is already in the store? I don't want to have to iterate over each item and check if that is possible.
This is from the load() documentation in store.js
"Load a new data hash into the store for a given id and type
combination. If data for that record had been loaded previously, the
new information overwrites the old. If the record you are loading data
for has outstanding changes that have not yet been saved, an exception
will be thrown."
As you can see, the new information overwrites the old, so it should be ok to reload the same data. Maybe you have another issue. Have you configured your id correctly?