Tuesday, March 29, 2011

Important about Triggers from bol



At most, one INSTEAD OF trigger per INSERT, UPDATE, or DELETE statement can be defined on a table or view.

INSTEAD OF triggers are not allowed on updatable views that use WITH CHECK OPTION.


Mutliple triggers are allowed in SQL server .

Order of multiple triggers is random in general,  however, the first and last trigger can be set using
Sp_settriggerorder. This sp can decide only  the first and last trigger.
Recursion in trigger is allowed, e.g. an update trigger may fire itself by updating its own table.
But this requires RECURSIVE_TRIGGERS setting of the database to be set.
INSTEAD OF Triggers cannot be recursive and there can not multiple instead of trigger for a single operation i.e. UPDATE,DELETE , INSERT .

Thursday, March 24, 2011

Silverlight Business Application Tutorial

http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/09/18/introduction-to-silverlight-and-wcf-ria-tutorial-part-1-setting-the-silverlight-site.aspx


http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/09/18/introduction-to-silverlight-and-wcf-ria-tutorial-part-2-displaying-data.aspx

http://blogs.microsoft.co.il/blogs/helpercoil/archive/2010/09/19/introduction-to-silverlight-and-wcf-ria-tutorial-part-3-domain-data-source.aspx


1.
Content="{Binding Path=Strings.ProductsTitle,      Source={StaticResource ApplicationResources}}"
Note Both the values : [Strings.ProductsTitle]
 and [StaticResource ApplicationResources]

2. Reference the Domain Service in Client App as  :
        Dim x As New BusinessApplication1.DomainService1
        Me.dg1.ItemsSource = x.Products
        x.Load(x.GetProductsQuery())

--When you add a EF model, build the "Web" project

--when you add the DomainService, buid the project

--Add the DomainService in "Services" folder

--When referencing the DomainService in the "Application" project,
 see that you use something like "BusinessApplication1.DomainService1"
 because the namespace "BusinessApplication1.Web.Services" and
 the variable "BusinessApplication1.Web.Services.ProductContext" is not
 available in "Application" project, because the DomainService is in the
 default namespace of "BusinessApplication" and not in
 "BusinessApplication1.Web.Services"
 If you want to use "BusinessApplication1.Web.Services" namespace
 then you need to go to ".vb" or ".vc"  file of the service
 and change the namespace



====================
Dim x As New BusinessApplication1.DomainService1
x.Load(x.GetProductsQuery())
Me.dg1.ItemsSource = x.Products'ProductsContext _pContext;'private void Page_Loaded(object sender, RoutedEventArgs e)'{ _pContext = new ProductsContext(); 'this.dg1.ItemsSource = _pContext.Products;' _pContext.Load(_pContext.GetProductsQuery());====================

Monday, March 21, 2011

''

Imports System
Imports System.Type
Imports System.ServiceModel
Imports System.ServiceModel.Description
Imports ClassLibrary1
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim tcpa As New Uri("net.tcp://localhost:8000")
        Dim sh As New ServiceHost(System.Type.GetType("ClassLibrary1.MyServiceClass,ClassLibrary1"), New Uri("net.pipe://localhost"), tcpa)
        Dim tcpb As New NetTcpBinding
        Dim mbehave As New ServiceMetadataBehavior
        sh.Description.Behaviors.Add(mbehave)
        sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex")
        sh.AddServiceEndpoint(GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexNamedPipeBinding, "mex")
        sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), tcpb, tcpa)
        sh.AddServiceEndpoint(System.Type.GetType("ClassLibrary1.IMyService,ClassLibrary1"), New NetNamedPipeBinding, New Uri("net.pipe://localhost"))
        sh.Open()
    End Sub
End Class

GetType Gotchas in VB .NET

Since VB .NET has a built in GetType method , some confusion is created when using GetType in VB .NET.

I will conclude following two points from my experience :

1. Use the VB .NET GetType  to get types  of System defined types.
2. Use System.Type.GetType("FullyqualifiedTypeName , AssemblyName") to get Type of user
defined types.

In the following, "MyServiceClass" is a class defined in an external class library ClassLibrary1. Further the class
implements IMyService interface, which is also defined in the same class library. Here the class and interface are being
refered outside of the class library, in a differenct project, with a reference to the ClassLibrary1.dll added.



Imports SystemImports System.TypeImports System.ServiceModelImports System.ServiceModel.DescriptionImports ClassLibrary1Public





sh.Description.Behaviors.Add(mbehave)
sh.AddServiceEndpoint(
sh.AddServiceEndpoint(
sh.AddServiceEndpoint(System.Type.GetType(
sh.AddServiceEndpoint(System.Type.GetType(
sh.Open()

End
Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadDim tcpa As New Uri("net.tcp://localhost:8000")Dim sh As New ServiceHost(System.Type.GetType("ClassLibrary1.MyServiceClass,ClassLibrary1"), New Uri("net.pipe://localhost"), tcpa)Dim tcpb As New NetTcpBindingDim mbehave As New ServiceMetadataBehaviorGetType(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex")GetType(IMetadataExchange), MetadataExchangeBindings.CreateMexNamedPipeBinding, "mex")"ClassLibrary1.IMyService,ClassLibrary1"), tcpb, tcpa)"ClassLibrary1.IMyService,ClassLibrary1"), New NetNamedPipeBinding, New Uri("net.pipe://localhost"))End Sub Class

Sunday, March 13, 2011

Try Catch block variable access scope


Are the variables declared in  a try block accessible in
the catch block ?
NO. For a variable to be accessible in both try and catch block
it must be declared outside of both blocks.
e.g in the following, variable ut is not accessible in
catch block because it is declared in try block, hence the code will not compile
and will give "Name "ut" is not declared" error

        Try
     Dim ut As New Utility
            Dim dr As DataRow() = x.[Select]("DateTime < '" & DateTime.Now.AddMinutes(-30).ToString("yyyy-MM-dd HH:mm:ss.fff") & "'")
            If dr.Length > 0 Then
                For Each drr As DataRow In dr
                    drr.Delete()
                    ut.WriteLog("C:\test.txt", "Deleted Some Records")
                Next
            End If
        Catch ex As Exception
            ut.WriteLog("C:\test.txt", "Deleted Some Records" + " " + ex.Message)
        End Try

Wednesday, March 9, 2011

What is wrong with this Connection String ?

QUESTION : What's  wrong with this connection string  ?


string
userid=gps;password=1234#";




ANSWER :  You will get the following error :
 "Keyword not supported:'userid'"






The correct connstr should be:
string connstr = "Data Source=IBM\\SFT;Initial Catalog=GPS_Live;User ID=gps;
uid=gps;password=gPs123!@#";
connstr = "Data Source=IBM\\SFT;Initial Catalog=GPS_Live;

Comparing features of LangGraph vs CrewAI

LangGraph Orchestration vs CrewAI Orchestration The following table compares LangGraph and CrewAI orchestration across their menta...