This question is locked. New answers and comments are not allowed.
Hi,
I built a WCF Project with the Data Services Wizard. I recognized that theDataManager Class 'InitializeManager()' method has already used "this.scope.TransactionProperties.AutomaticBegin = true;" ,I don't know whether or not I should use the "scope.Transaction.Commit();"
Because of the "wcfcl.CreatPerson(p);" never saved the data actually.
Thanks.
I built a WCF Project with the Data Services Wizard. I recognized that theDataManager Class 'InitializeManager()' method has already used "this.scope.TransactionProperties.AutomaticBegin = true;" ,I don't know whether or not I should use the "scope.Transaction.Commit();"
WCFServiceClient wcfcl = new WCFServiceClient(); |
Person p = new Person(); |
p.Name="Test"; |
wcfcl .CreatePerson(p); |
Thanks.
5 Answers, 1 is accepted
0
Hi xu,
This problem has already been addressed and will be fixed in the next version of the Data Services wizard. In the meantime, please add manually the scope.Transaction.Commit() line at the end of the try{} block of the according method in the DataManager. We are sorry for the inconvenience.
Sincerely yours,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
This problem has already been addressed and will be fixed in the next version of the Data Services wizard. In the meantime, please add manually the scope.Transaction.Commit() line at the end of the try{} block of the according method in the DataManager. We are sorry for the inconvenience.
Sincerely yours,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
xu
Top achievements
Rank 1
answered on 11 Mar 2010, 06:04 AM
Hi,Alexander
Thanks for your reply.I had added manually the scope.Transaction.Commit() line at the end of the try{} block of the according method in the DataManager.But it is not a proper idea. It will absorb much of transaction time when I add a great quantity entities.
Thanks for your reply.I had added manually the scope.Transaction.Commit() line at the end of the try{} block of the according method in the DataManager.But it is not a proper idea. It will absorb much of transaction time when I add a great quantity entities.
0
Hello xu,
To execute multiple insert operations in one step you need to create a new function that accepts a list of your new entities then add those entities to your scope provider. The final step is to commit the transaction,
Ffirst add the following function to your data manager
You should do the following for each entity that you want to execute large sum of insert operations:
Aadd the following line to the service interface
You should just change Customer with your entity name:
Then you need to add this function implementation in the service code behind,
Best wishes,
Peter Bahaa
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
To execute multiple insert operations in one step you need to create a new function that accepts a list of your new entities then add those entities to your scope provider. The final step is to commit the transaction,
Ffirst add the following function to your data manager
01.
public List<
string
> CreateEntities<
T
>(List<
T
> entitiesList)
02.
{
03.
try
04.
{
05.
List<
string
> entitiesIds = new List<
string
>();
06.
foreach (var entity in entitiesList)
07.
{
08.
this.scope.Add(entity);
09.
10.
IObjectId entityId = Database.GetObjectId(entity);
11.
entitiesIds.Add(entityId.ToString());
12.
}
13.
14.
this.scope.Transaction.Commit();
15.
16.
return entitiesIds;
17.
}
18.
catch (Telerik.OpenAccess.OpenAccessException ex)
19.
{
20.
this.RollBackTransaction(this.scope);
21.
throw ex;
22.
}
23.
}
You should do the following for each entity that you want to execute large sum of insert operations:
Aadd the following line to the service interface
1.
[OperationContract]
2.
List<
string
> CreateCustomers(List<
ClassLibrary1.Customer
> customers);
You should just change Customer with your entity name:
Then you need to add this function implementation in the service code behind,
1.
public List<
string
> CreateCustomers(List<
ClassLibrary1.Customer
> customers)
2.
{
3.
return dataManager.CreateEntities<
ClassLibrary1.Customer
>(customers);
4.
}
Best wishes,
Peter Bahaa
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
xu
Top achievements
Rank 1
answered on 12 Mar 2010, 01:12 AM
Hi,
Thanks,but why cant Auto-generate the Source File from the DSW?
It will be better if the DSW generate complete standard functions to support CURD operation for entities!
Thanks,but why cant Auto-generate the Source File from the DSW?
It will be better if the DSW generate complete standard functions to support CURD operation for entities!
0
Hi xu,
We will add this enhancement to our next release which is scheduled for this month.
All the best,
Peter Bahaa
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
We will add this enhancement to our next release which is scheduled for this month.
All the best,
Peter Bahaa
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.