Archive for June, 2005

I saw a post in .netindiagroup regd how to manipulate the GAC  programmatically and though I had suggest few workaround for the same listing below, i had doubts on the requirement raised for the same?does it required to use GAC or not and when you ll prefer to use GAC .then i remember a long discussion but very useful one between chris sell,ala shi and useful comments by many..more which is quite useful to consider when you prefer to use GAC or not?

Two topics worth reading on this aspect are

CHRIS SELLS Avoid the GAC

ALAN SHI"S GAC Phobia

My points are :- I would suggest when should i prefer using GAC:-

1. when i need to provide an important fix to my app.

2.More then true when i need to supply backward compatibilty and my assembly to run in full trust.

3.whenever i needto share a componet between different app(no other way here).

Even though there is significant concern as raised by chris the more is with the approach we followed for our deployment and chris is true to certain extent so as few other’s who made commnets in alan shi’s response  regd the fact that  there is no other option to provide a publisher policy for the updates and which is many times a  tedious task and there is many problems for related to the same .

However without GAC also some we could have asked for the fact why there is no option avalable for backward compatibility and  componet sharing  and the GAC hell due to the wrong implementation is far better then  DLL hell which we suffered and the Binary compatibility of COM was too tedious and subject to more design restriction then the gac .atleast we can ship the publisher policy separately to avoid the same with few restriction.

Howvere even though the purpose of GAC and the usefull ness of the same are questionable with the above two discussion i found it quite astonishing as how both chris and alan didn’t have the issue realted to the dependent assembly load and the control and issue related to using partial load,assembly.load as well as the assembly.loadfrom.

The trust level associated  and the way the assembly were searched when it is local ,when it is loaded in a shared network and when it has few dependent assembly has significant changes when we are dealing with private assembly and Gaced assembly.

Soon i ll post on the same as well as I ll post the same concerns to Alan and chris.

Now ending today’s post with few  links for programming and issue /workign with gac:-

Also read for why the uninstall /install a problem and the workaround in GAC by alan shi

Why can’t I uninstall my assembly?

Undocumented Fusion:

 

Mattias’s sample:

 

sam gentile if PIA in GAC:-

 

GAC API Interface By atoenne 

 

Why do you use GAC APIs?

 

Demystifying the .NET Global Assembly Cache By Jeremiah Talkar 

 

http://www.grimes.demon.co.uk/workshops/fusWSSeven.htm


http://support.installshield.com/kb/view.asp?articleid=Q111094


http://dotnet.org.za/colin/archive/2005/05/10/19709.aspx


http://www.belshe.com/ideas/archives/000040.html

 

 

Jim Jhonson had some really  good stuff on the dependent transaction .While reading thru the aspect and scope of the transaction I had few doubts and thanks Jim for the Nice reply..

My doubt was do the dependent transaction can be used without ES?How the transaction scope fit into the  per db and/or user session Appdomain of yukon ?

Read here

Multithreading with DependentTransaction

 

Jim jhonson  has some good stuff on dependent transaction and transaction scope class for the new system.transaction class an drelated features in .Net2.0.

however how can not post the post of ballidos and sahil

http://blogs.msdn.com/angelsb/archive/2004/07/07/175586.aspx   http://blogs.msdn.com/angelsb/archive/category/6274.aspx

http://codebetter.com/blogs/sahil.malik/archive/2004/12/06/35314.aspx and

http://www.windowsitpro.com/SQLServer/Articles/ArticleID/46104/pg/2/2.html

So here go how you can manipulate the same :with a small example:-

For intro watch msdntv and

add a ref to transaction.dll

using System;
using System.Transactions;
using System.Data;
using System.Data.SqlClient;

// Start a transaction.
//if not using the sqlserver explicitly enlist is reqd and if we ve multiple resource manager then
//it ll be taken care by msdtc what we ll do is insert a single record and then inside the trasaction scope we ll insert another
//with a diff connection the sql provider ll enlist in same transaction by default
//the final commit staement is somewaht awakward as it shows Consistent = true not .commit or rollback????(may be u can answer them)

namespace transactiontest
{
    class testtran
    {
        static void Main(string[] args)
        {
           
            using (TransactionScope Tscope = new TransactionScope())
            {
                //sql provider automatically enlist in the trasaction
                using (SqlConnection con = new SqlConnection("connstr here"))
                {
                    using (SqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "INSERT INTO emp VALUES (‘shree’, 30,4000)";
                        con.Open();
                        cmd.ExecuteNonQuery();
                    }
                }

               
                using (SqlConnection con = new SqlConnection("connstr here"))
                {
                    using (SqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = "INSERT INTO dept VALUES (‘software’, 20,’acc’)";
                        conn.Open();
                        cmd.ExecuteNonQuery();
                    }
                }
              
                Console.WriteLine("want to Commit?");
                string ans = Console.ReadLine();
                if (ans == "yes")
                {
                    Tscope .Consistent = true;
                }
            }
        }
    }
}