Author |
Share Topic Topic Search Topic Options
|
glenwinn
Newbie
Joined: 23-Jun-2009
Location: Plano
Posts: 5
|
Post Options
Quote Reply
Topic: Save not working if Entity is DataSource of a BindingSource Posted: 25-Jun-2009 at 12:25pm |
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 24-Jun-2009 at 1:00pm |
Sorry, but I can't repro the problem you're seeing. Please zip up a solution showing the problem and send it to IdeaBladeSupportTrack@ideablade.com, referencing task #5550 in the subject line. Thanks!
|
 |
glenwinn
Newbie
Joined: 23-Jun-2009
Location: Plano
Posts: 5
|
Post Options
Quote Reply
Posted: 24-Jun-2009 at 10:32am |
Yes, it is an integer field set as auto increment in the object mapper.
I also noticed that the server is trying to save the entity twice when I called .SaveChanges() just once on the client. This behavior changes when I do not set the DataSource property of the binding source. The ' Vendors to be Modified: 1' log entry only shows up once.
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 24-Jun-2009 at 9:18am |
The server debuglog shows that a concurrency exception occurred. Do you have any concurrency fields defined for the Vendor entity, and if so, how is the value updated?
|
 |
glenwinn
Newbie
Joined: 23-Jun-2009
Location: Plano
Posts: 5
|
Post Options
Quote Reply
Posted: 24-Jun-2009 at 6:28am |
- I made sure the model on the server and the client were the same version by rebuilding all and deploying to the BOS directory.
- I checked the version of the IdeaBlade dlls on the client and the server and they are correct (5.1.1.0 and 3.6.7.1)
Here is the simple Windows Forms program I am using (Sorry for the bad formatting):
If I comment out the line that assigns the _vendor to the DataSource property then everything works.
public partial class Form1 : Form
{
DomainModelEntityManager _em = new DomainModelEntityManager(true, "Dev");
Vendor _vendor;
public Form1()
{
InitializeComponent();
IdeaBladeConfig idconfig = IdeaBladeConfig.Instance;
ObjectServerElement osel = idconfig.ObjectServer;
osel.ServerPort = 9009;
osel.RemoteBaseUrl = "http://citybots-dev.citybots.com";
LoginCredential lc = new LoginCredential("xxx", "xxx", "dev");
_em.Login(lc);
_vendor = _em.Vendors.Where(vendor => vendor.AutoId == 2560).FirstOrNullEntity();
this.txtVendorName.Text = _vendor.Name;
bindingSource1.DataSource = _vendor;
}
private void btnSave_Click(object sender, EventArgs e)
{
_vendor.Name = this.txtVendorName.Text;
_em.SaveChanges();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
Here is the debug log from the server:
2009-06-24 |
08:11:43 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EntityServer::Fetch |
Fetch ... value(IdeaBlade.EntityModel.EntityQueryProxy`1[DomainModel.Vendor]).Where(vendor => (vendor.AutoId = 2560)).FirstOrDefault() |
2009-06-24 |
08:11:43 |
gwinn@winns.us |
IdeaBlade.EntityModel.Edm |
ObjectQueryProcessor::WriteGeneratedSql |
SELECT 1 AS [C1], [Extent1].[Id] AS [Id], [Extent1].[AutoId] AS [AutoId], [Extent1].[EId] AS [EId], [Extent1].[Name] AS [Name], [Extent1].[Creator] AS [Creator], [Extent1].[CreateDate] AS [CreateDate], [Extent1].[LastUpdater] AS [LastUpdater], [Extent1].[LastUpdate] AS [LastUpdate], [Extent1].[RowVersion] AS [RowVersion], [Extent1].[DoingBusinessAs] AS [DoingBusinessAs], [Extent1].[TaxId] AS [TaxId], [Extent1].[BusinessDescription] AS [BusinessDescription], [Extent1].[SessionId] AS [SessionId], [Extent1].[IsDeleted] AS [IsDeleted], [Extent1].[CertString] AS [CertString], [Extent1].[EthnicGroup] AS [EthnicGroup], [Extent1].[Gender] AS [Gender], [Extent1].[VendorType] AS [VendorType], [Extent1].[IngressMethod] AS [IngressMethod], [Extent1].[FeedSource] AS [FeedSource] FROM [dbo].[Vendor] AS [Extent1] WHERE 2560 = [Extent1].[AutoId] |
2009-06-24 |
08:11:47 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EntityServer::GetInstanceImplementing |
Unable to locate an implementation of: IdeaBlade.EntityModel.IEntityServerSaving |
2009-06-24 |
08:11:47 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EdmSaveHelper::<TraceChanges>b__4f |
Vendors to be Modified: 1 |
2009-06-24 |
08:11:58 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EntityServer::GetInstanceImplementing |
Unable to locate an implementation of: IdeaBlade.EntityModel.IEntityServerSaved |
2009-06-24 |
08:11:58 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EdmSaveHelper::<TraceChanges>b__4f |
Vendors to be Modified: 1 |
2009-06-24 |
08:11:58 |
gwinn@winns.us |
IdeaBlade.EntityModel.Server |
EdmSaveHelper::Save |
Entity Save Error: System.Data.OptimisticConcurrencyException: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries. at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) at System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave) at System.Data.Objects.ObjectContext.SaveChanges() at IdeaBlade.EntityModel.Server.EdmSaveHelper.Save() |
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 23-Jun-2009 at 8:13pm |
A few things to check -
- make sure you've rebuilt the domain model and that this updated version is the same on both client and server
- check all the DevForce assemblies on both client and server to make sure they are also in sync
Check the debuglog generated on the server - it might have logged an error prior to the client receiving this message.
Let me know what you find.
|
 |
glenwinn
Newbie
Joined: 23-Jun-2009
Location: Plano
Posts: 5
|
Post Options
Quote Reply
Posted: 23-Jun-2009 at 11:32am |
I just upgraded to 5.1.1 and am now having problems saving an entity that is a data source for a System.Windows.Forms.BindingSource. The code was working fine until I upgraded. I am using the BindingSource with a ControlBindingManager.
The exception is :
EntityManagerSaveException:
An error occurred while receiving the HTTP response to http://citybots-dev.citybots.com:9009/EntityServer. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
|
 |