Skip to main content

Posts

Making assembly visible to a COM component

Following steps are necessary to make an assembly visible to a COM component: Set the Register for COM option under the build configuration Set the ComVisible attribute to true for each class you want exposed Set the ComVisible attribute to false for any class members you want hidden Set the ComVisible attribute to true for any class members that you want visible CodeProject

Using frequently build assembly in another applications (.Net)

Assume that you are creating a strong named MyAssembly that will be used in several applications. The assembly will be rebuilt frequently during the development cycle. But one must ensure that every time MyAssembly is rebuilt, it works properly with all applications that use it. So, in order to obtain this, we are required to configure the computer on which we develop the assembly such that each application uses the latest build of MyAssembly. To accomplish the above task, take the following action: To point to the build output directory for the strong named assembly, create a DEVPATH environment variable Add the following element to the machine configuration file:   <developmentMode developerInstallation="true"> . T his element tells the CLR to use DEVPATH to locate assembly. CodeProject

What is a serviced component?

A services component is a .Net component that uses component services of COM+, such as object pooling, transaction management etc. It executes within the managed execution environment of the .Net framework and shares its context with a COM+ application. It enables context sharing between COM+ and .Net framework classes. A serviced component is creates by defining  class that directly or indirectly derives from the ServicesComponent class. It utilizes COM+ services by using attributes of the System.EnterpriseServices namespace. A serviced component should be registered before it can access the component services of COM+. The following three types of registrations are used to register a serviced component: Manual registration: The .Net Framework Service Installation (Regsvcs.exe) tool is used to manually register an assembly containing a serviced component. Manual registration is used for design-time testing to find out the error types that may occur at runtime. Dynamic registrati...

Covariance and Contravariance feature of .NET 4.0

Hi, I'll consider below class hierarchy throughout this explanation: class Account { } class Savings : Account { } class Current : Account { } Now lets begin with Example 1 : class Program { delegate T MyDel <T>(); static void Main( string [] args) { MyDel < Savings > objSavings = () => new Savings (); MyDel < Account > objAccount = objSavings; } } The code shown in  Example 1 will not work in versions prior to 4.0. But if you change generic parameter T to OUT T in 4.0, then this assignment compatibility work via CoVariance . Now check this 4.0 code in Example 2: class Program { delegate T MyDel <out T>(); static void Main( string [] args) { MyDel < Savings > objSavings = () => new Savings (); MyDel < Account > objAccount = objSavings; } } The only change in  ...

Certain authenticated sharepoint users get "Access Denied" error

When we add our Active Directory groups into Sharepoint site groups, some of the group members receives Access Denied message. This is the problem faced in sharepoint 2007 and doesn't resolve even  individual members of the group are added. So, to get rid of it, just try through following steps: add users in DomainName/UserName format, instead of using just UserName. Avoid adding AD groups directly if you have hosted your site on port 80, and using different name apart from machine name as http://ABC, in this case don't forget to make a entry of your site in Alternate Access Path, under operations tab in central administration. Hope, this post is helpful to you :)

Lazy initialization – Lazy (.NET 4.0)

With lazy initialization, the memory for an object is not allocated until it is needed. This mainly used to improve performance, reduces unnecessary computations and also reduce memory requirements . This can be useful in following scenarios: When creation of object is expensive and we want to deferred the creation until it is used. When you have an object that is expensive to create, and the program might not use it. For example, assume that you have in memory a  Customer  object that has an  Orders  property that contains a large array of  Order  objects that, to be initialized, requires a database connection. If the user never asks to display the Orders or use the data in a computation, then there is no reason to use system memory or computing cycles to create it. By using  Lazy<Orders>  to declare the  Orders  object for lazy initialization, you can avoid wasting system resources when the object is not used. Examp...