Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET WCF SOAP SOA
Hi,
 
I wish to insert data into database using WCF service. But I am confused that whether it will work when many clients e.g 250 clients try consuming the service and inserting data into database at the same time? I think database may get locked at certain point of time? If that is so, What may be the solution to this. If not, why? How will it be handled?
 
Thanks.
Posted 20-Mar-13 1:18am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

IDALService.cs
[OperationContract]
        bool functionname(int mID, string mName);
 
DALService.svc.cs
public bool functionname(int mID, string mName)
        {
            return mobjDal.functionname(mID, mName);
        }
 

DAL File(Class.cs)
public bool functionname(int mID, string mName)
{
try
{
tblTable objTable = new tblTable(); // objTable is object of table in which you want to add record
objTable.ID = mID;
objTable.Name = mName;
mobjEntity.tblTable.AddObject(objTable); // mobjEntity is the object of Entity
mobjEntity.SaveChanges();
return true;
}
catch(Exception mEx)
{
return false;
}
}
 
Please go through following url for implement Transaction on OperationContract
6 Steps to Enable Transactions in WCF[^]
 
Hope this post will help you..
Regards,
Jitendra Kumar
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Consuming of the Wcf service is not a problem, That i know, But The problem is that through this service all the clients will insert the data in to database at the same point of time. Will that create a problem? or the wcf service manages that at its own end? If That could be managed at the service end , Then what I need to DO.?
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

I think its better to handle this situation by using SQL Broker Service[^]
1: Insert Data in Broker Queue using WCF Service
2: Create a service that read Broker Queue periodically and Insert in to what ever you want. 
  Permalink  
Comments
sudeep kushwaha at 20-Mar-13 8:49am
   
Is there any other Options? Actually i have never used SQL Server Service Broker.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

i think that, there is no problem that how many users are consuming your WCF service at a time.
  Permalink  
Comments
sudeep kushwaha at 20-Mar-13 7:41am
   
Consuming of the Wcf service is not a problem, That i know, But The problem is that through this service all the clients will insert the data in to database at the same point of time. Will that create a problem? or the wcf service manages that at its own end? If That could be managed at the service end , Then what I need to DO.?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100