I have an application with both Windows Forms and ASP.NET front ends and
uses both integrated web security and a security database. The problem I
have is that I need to syncronize these security databases.
The web front end uses ASP membership with the SQL provider, the database is
moved to the SQL Server instead of the SQL Express datafile.
The Windows Forms app uses tables such as "users" within the database.
If I add a user on the website, I need also to add a user to the database
"users" table.
To achieve this I write a business layer component that wraps both the
security data tables and the ASP.NET membership functions. So for instance,
to delete a user...
[DataObjectMetho d(DataObjectMet hodType.Delete, true)]
static public void Delete(string UserName)
{
// delete user from internal database table "users"
usersTableAdapt er UserTableAdapte r = new usersTableAdapt er();
int rowsAffected = UserTableAdapte r.DeleteByName( UserName);
// delete user from ASP.NET membership database
Membership.Dele teUser(UserName , true);
}
The question is how do I get these two functions into a transaction so that
if the deletion for the ASP.NET member fails, the delete on the internal
database table is rolled back?
--
Best regards
Mark 4 1431
One of the golden rules of software development is never, ever to hold the
same data in more than one place. It's a maintenance nightmare.
Is there no way you can get both front ends to use the same data?
Petere
"Mark Baldwin" <sW*****@commun ity.nospamwrote in message
news:uH******** *****@TK2MSFTNG P06.phx.gbl...
>I have an application with both Windows Forms and ASP.NET front ends and uses both integrated web security and a security database. The problem I have is that I need to syncronize these security databases.
The web front end uses ASP membership with the SQL provider, the database
is moved to the SQL Server instead of the SQL Express datafile.
The Windows Forms app uses tables such as "users" within the database.
If I add a user on the website, I need also to add a user to the database
"users" table.
To achieve this I write a business layer component that wraps both the
security data tables and the ASP.NET membership functions. So for
instance, to delete a user...
[DataObjectMetho d(DataObjectMet hodType.Delete, true)]
static public void Delete(string UserName)
{
// delete user from internal database table "users"
usersTableAdapt er UserTableAdapte r = new usersTableAdapt er();
int rowsAffected = UserTableAdapte r.DeleteByName( UserName);
// delete user from ASP.NET membership database
Membership.Dele teUser(UserName , true);
}
The question is how do I get these two functions into a transaction so
that if the deletion for the ASP.NET member fails, the delete on the
internal database table is rolled back?
--
Best regards
Mark
<<What he said>>
I'd strongly recommend (with emphasis on the strongly) not trying to keep
"sync" data.
Using the Provider Model, you can create your ~own
MyCustomMembers hipProvider : MembershipProvi der
This will allow you to use your custom tables, and such.
There's no reason why you can't use your MyCustomMembers hipProvider from a
Winforms.
You'll just lose the "drag and drop" ability that you have in asp.net 2.0.
See http://www.15seconds.com/issue/050216.htm
"Peter Bradley" <pb******@uwic. ac.ukwrote in message
news:OQ******** ******@TK2MSFTN GP04.phx.gbl...
One of the golden rules of software development is never, ever to hold the
same data in more than one place. It's a maintenance nightmare.
Is there no way you can get both front ends to use the same data?
Petere
"Mark Baldwin" <sW*****@commun ity.nospamwrote in message
news:uH******** *****@TK2MSFTNG P06.phx.gbl...
I have an application with both Windows Forms and ASP.NET front ends and
uses both integrated web security and a security database. The problem I
have is that I need to syncronize these security databases.
The web front end uses ASP membership with the SQL provider, the
database
is moved to the SQL Server instead of the SQL Express datafile.
The Windows Forms app uses tables such as "users" within the database.
If I add a user on the website, I need also to add a user to the
database
"users" table.
To achieve this I write a business layer component that wraps both the
security data tables and the ASP.NET membership functions. So for
instance, to delete a user...
[DataObjectMetho d(DataObjectMet hodType.Delete, true)]
static public void Delete(string UserName)
{
// delete user from internal database table "users"
usersTableAdapt er UserTableAdapte r = new usersTableAdapt er();
int rowsAffected = UserTableAdapte r.DeleteByName( UserName);
// delete user from ASP.NET membership database
Membership.Dele teUser(UserName , true);
}
The question is how do I get these two functions into a transaction so
that if the deletion for the ASP.NET member fails, the delete on the
internal database table is rolled back?
--
Best regards
Mark
And see http://msdn2.microsoft.com/en-us/lib...5e(VS.80).aspx
(read my other post first)
"Peter Bradley" <pb******@uwic. ac.ukwrote in message
news:OQ******** ******@TK2MSFTN GP04.phx.gbl...
One of the golden rules of software development is never, ever to hold the
same data in more than one place. It's a maintenance nightmare.
Is there no way you can get both front ends to use the same data?
Petere
"Mark Baldwin" <sW*****@commun ity.nospamwrote in message
news:uH******** *****@TK2MSFTNG P06.phx.gbl...
I have an application with both Windows Forms and ASP.NET front ends and
uses both integrated web security and a security database. The problem I
have is that I need to syncronize these security databases.
The web front end uses ASP membership with the SQL provider, the
database
is moved to the SQL Server instead of the SQL Express datafile.
The Windows Forms app uses tables such as "users" within the database.
If I add a user on the website, I need also to add a user to the
database
"users" table.
To achieve this I write a business layer component that wraps both the
security data tables and the ASP.NET membership functions. So for
instance, to delete a user...
[DataObjectMetho d(DataObjectMet hodType.Delete, true)]
static public void Delete(string UserName)
{
// delete user from internal database table "users"
usersTableAdapt er UserTableAdapte r = new usersTableAdapt er();
int rowsAffected = UserTableAdapte r.DeleteByName( UserName);
// delete user from ASP.NET membership database
Membership.Dele teUser(UserName , true);
}
The question is how do I get these two functions into a transaction so
that if the deletion for the ASP.NET member fails, the delete on the
internal database table is rolled back?
--
Best regards
Mark
Hello Mark,
As Peter and sloan have suggested, you can build a custom provider to do
the work. Or if you want to manage such synchronized database updating, you
can use the ADO.NET's Transaction(for updating in single database). Or if
the tables are in different database, you can consider using classes in
System.Transacd tions namespace to perform multi-database transaction.
In addition, for ASP.NET SQL Membership &Role provider(and its API), you
can feel free to use it in non-asp.net application also(winform or console
application). What you need to do is simply copy those configuration about
ASP.NET membership & role(from your web application's web.config file to
your non-ASP.NET application's app.config file). Here is a blog article
I've ever writen to demonstrate this:
#Manage database of ASP.NET 2.0 Membership & Role services in non-ASP.NET
context http://blogs.msdn.com/msdnts/archive...mbership-role-
management-out-of-asp-net-context.aspx
Thus, you can let your winform application use the same API and access the
same membershp &role data as the ASP.NET application.
If you have any other specific question, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bob |
last post by:
I've got a 3-tiered WinForms application in C# .net. The
presentation layer (client exe) contains references to
the Business layer (dll), and everything works great on
the same machine, but when deployed the clients will be
on different machines accessed from the network. How
does the presentation layer call the Business layer from
a different machine?
I know I can use WebServices, but that doesn't seem right
for an business...
|
by: G. Stewart |
last post by:
The word "Business" in the term implies some sort of commercial
aspects or connotations. But from what I can see, that is not
necesserially the case at all?
So what is the reasoning behind the term?
Stupid question, I know ... and quite irrelevant in many ways ... but
I really would like to know!
|
by: Big Dave |
last post by:
Does anyone have suggestions on how to best handle errors in business
objects that are part of a business layer? For example:
Public Class Person
Private _name as string
Public Property Name as string
Get
Return _name
End Get
Set(Value as string)
|
by: MS newsgroup |
last post by:
I don't have clear reasons why we need business logic layer and data logic
layer instead of having only data logic layer.
Are there any good reasons for that?
|
by: morleyc |
last post by:
Hi, until recently i was quite happy to add data sources from mssql
database in visual studio and drag the datasets directly onto the form
this creating a directly editable form which worked well.
However i have recently started a project which will require
synchronization to a remote database. Also the underlying database
provider may change at a later date. From what i have read it seems
that a layered approach is necessary, or at...
| |
by: Charles Law |
last post by:
This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.
I have a presentation layer, business layer and data access layer, the first
is the EXE, whilst the other two are implemented as DLLs. The EXE also
references a DLL that contains various user controls, one of which is based
on a grid control.
The coupling is currently like this:
|
by: JTP PR |
last post by:
Business Intelligence software company, Yellowfin today announced its
successful foray into the Asia Pacific telecommunications sector
through its expanding partner network. Two organisations, InterAcct
Solutions and Utilibill have selected the Yellowfin web-based Business
Intelligence (BI) reporting application as the front end presentation
layer for their customer business reporting solutions throughout Asia
Pacific.
The Yellowfin BI...
|
by: psycho |
last post by:
I am working on an N-tier application using following components:
1. Data Access Layer using DLINQ which consists of Data Context class
and Table Mapping classes.
2. Business Logic Layer.
3. Presentation Layer (normal ASP.NET pages)
The problem is that I have to handle database transactions which can
span multiple tables. So where should I place the transaction code. I
think I should do it in BLL. But how do I control the transaction at...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |