Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is true that only the data tier is for WCF?
Message
From
29/01/2013 04:14:59
 
 
To
28/01/2013 22:56:14
General information
Forum:
ASP.NET
Category:
Windows Communication Foundation (WCF)
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01564433
Message ID:
01564443
Views:
35
No reason why you cannot use multiple services. Or one service with multiple contracts
But the best approach may be dictated by the physical rather than the logical configuration of the application ?.

>I want to know if the only data tier is used to be created as WCF project in .NET solution.
>or it can be more than one WCF project in a solution for example business workflow.
>Here is an example used in WCF, i showed below the code of an example.
>
>implementing interfaces
>
>
>
> NOTA: puede usar el comando "Cambiar nombre" del menú contextual para cambiar el nombre de clase "MAIRServicio" en el código, en svc y en el archivo de configuración a la vez.
>Imports System.Data
>Imports System.Data.SqlClient
>Imports System.Configuration
>Imports EntidadesNegocio
>'Imports Sistema.Componentes
>
>Public Class MAIRServicio
>    Implements IMAIRServicio
>
>    Private Cnx As SqlConnection
>    Private Dap As SqlDataAdapter
>    Private Cmd As SqlCommand
>    Private Tb As DataSet
>    Private Function getCadenaConexion() As String
>        Dim strCnx As String = ConfigurationManager.ConnectionStrings("MiConexion").ConnectionString
>
>        If strCnx Is String.Empty Then
>            Return String.Empty
>        Else
>            Return strCnx
>        End If
>    End Function
>
>    'Public Function RUNSql(ByVal Sentencia As String) As Integer
>    Public Function RUNSql(ByVal Sentencia As String) As DataSet
>
>        'Private Cnx As SqlConnection
>        'Call getCadenaConexion()
>        Dap = New SqlDataAdapter(Sentencia, getCadenaConexion())
>        Tb = New DataSet
>        Dap.Fill(Tb)
>
>        Return Tb
>    End Function
>
>
>
>
>
>#Region "Factura"
>
>    Public Function FacturaPrincipal_ins(ByVal FacturaPrincipalx As Factura) As Integer Implements IMAIRServicio.FacturaPrincipal_ins
>        Cnx = New SqlConnection(getCadenaConexion)
>        Cmd = New SqlCommand("sp_ins_FacturaPrincipal", Cnx)
>        With Cmd
>            .CommandType = CommandType.StoredProcedure
>            .Parameters.AddWithValue("@NumeroFactura", FacturaPrincipalx.NumeroFactura)
>            .Parameters.AddWithValue("@CodigoGuia", FacturaPrincipalx.CodigoGuia)
>            .Parameters.AddWithValue("@CodigoCliente", FacturaPrincipalx.CodigoCliente)
>            .Parameters.AddWithValue("@Subtotal", FacturaPrincipalx.Subtotal)
>            .Parameters.AddWithValue("@Igv", FacturaPrincipalx.Igv)
>            .Parameters.AddWithValue("@Total", FacturaPrincipalx.Total)
>            .Parameters.Add("@Codigo", SqlDbType.Int).Direction = ParameterDirection.Output
>        End With
>        Try
>            Cnx.Open()
>            Cmd.ExecuteNonQuery()
>            Cnx.Close()
>            Return Cmd.Parameters("@Codigo").Value
>        Catch ex As Exception
>            Throw New Exception(ex.Message)
>        End Try
>
>    End Function
>
>    Public Function FacturaPrincipal_upd(ByVal FacturaPrincipalx As Factura) As Integer Implements IMAIRServicio.FacturaPrincipal_upd
>
>
>        Cnx = New SqlConnection(getCadenaConexion)
>
>
>        Dim grabo As Int16
>        Cmd = New SqlCommand("sp_upd_FacturaPrincipal", Cnx)
>        With Cmd
>            .CommandType = CommandType.StoredProcedure
>            .Parameters.AddWithValue("@NumeroFactura", FacturaPrincipalx.NumeroFactura)
>            .Parameters.AddWithValue("@CodigoGuia", FacturaPrincipalx.CodigoGuia)
>            .Parameters.AddWithValue("@CodigoCliente", FacturaPrincipalx.CodigoCliente)
>            .Parameters.AddWithValue("@Subtotal", FacturaPrincipalx.Subtotal)
>            .Parameters.AddWithValue("@Igv", FacturaPrincipalx.Igv)
>            .Parameters.AddWithValue("@Total", FacturaPrincipalx.Total)
>
>        End With
>        Try
>            Cnx.Open()
>            Cmd.ExecuteNonQuery()
>            Cnx.Close()
>            ' grabo = 1   si grabo, grabo = 0  no grabo 
>            grabo = 1
>            Return grabo
>        Catch ex As Exception
>            Throw New Exception(ex.Message)
>            grabo = 0
>            Return grabo
>        End Try
>
>    End Function
>
>
>    Public Function FacturaPrincipal_del(ByVal FacturaPrincipalx As Factura) As Integer Implements IMAIRServicio.FacturaPrincipal_del
>
>        Cnx = New SqlConnection(getCadenaConexion)
>
>        Dim borrar As Int16
>        Cmd = New SqlCommand("sp_del_FacturaPrincipal", Cnx)
>        Cmd.CommandType = CommandType.StoredProcedure
>        Cmd.Parameters.Add("@CodigoFactura", SqlDbType.Int).Value = FacturaPrincipalx.CodigoFactura
>        'Dim n As Int16
>        Cnx.Open()
>        Try
>            borrar = Cmd.ExecuteNonQuery
>        Catch ex As Exception
>            borrar = 0
>        End Try
>
>        Cnx.Close()
>        Return borrar
>    End Function
>
>    Public Function FacturaPrincipal_Listar() As System.Data.DataSet Implements IMAIRServicio.FacturaPrincipal_Listar
>        Dim Dap As New SqlDataAdapter("sp_lis_Factura", Cnx)
>        Dim dst As New DataSet
>        Dap.Fill(dst, "Facturas")
>        Return dst
>    End Function
>#End Region
>
>#Region "Cliente"
>    'Public Sub RUNSql(ByVal Sentencia As String)
>    '    Da = New SqlDataAdapter(Sentencia, Cn)
>    '    Ds = New DataSet
>    '    Da.Fill(Ds)
>    'End Sub
>
>    Function Clientes_cargar() As DataSet Implements IMAIRServicio.Clientes_cargar
>        Dim sentencia As String
>        sentencia = "Select * from Clientes"
>        Dim registros As DataSet
>        registros = New DataSet
>        registros = RUNSql(sentencia)
>        'registros.Tables(0).Columns(0).ind 
>        Return registros
>        'Call RUNSql(sentencia)
>        'Return 0
>    End Function
>
>
>
>    Public Function Cliente_ins(ByVal Clientex As Cliente) As Integer Implements IMAIRServicio.Cliente_ins
>        Cnx = New SqlConnection(getCadenaConexion)
>        Cmd = New SqlCommand("sp_ins_clientes", Cnx)
>        With Cmd
>            .CommandType = CommandType.StoredProcedure
>            .Parameters.AddWithValue("@NombreCliente", Clientex.NombreCliente)
>            .Parameters.AddWithValue("@Direccion", Clientex.Direccion)
>            .Parameters.AddWithValue("@Telefono", Clientex.Telefono)
>            .Parameters.AddWithValue("@NombreContacto", Clientex.NombreContacto)
>            .Parameters.Add("@Codigo", SqlDbType.Int).Direction = ParameterDirection.Output
>        End With
>        Try
>            Cnx.Open()
>            Cmd.ExecuteNonQuery()
>            Cnx.Close()
>            Return Cmd.Parameters("@Codigo").Value
>            MsgBox("se supone que todo salio bien")
>        Catch ex As Exception
>            Throw New Exception(ex.Message)
>        End Try
>    End Function
>
>#End Region
>
>End Class
>
Previous
Reply
Map
View

Click here to load this message in the networking platform