Sunteți pe pagina 1din 3

Expression builders allow property values to be set and retrieved in a control d

uring page parsing. When the page parser encounters an expression in the format.
<%$ prefix:value %>, it creates an expression builder based on prefix and passes
the value to the expression builder for evaluation. The expression builder then
returns the requested value to the page.
Benefits of expression builders
You can avoid writing lengthy code to set property values at run time. Expressio
n builders allows to include dynamic information using one declarative statement
.
A single Expression builder can be referenced across multiple pages. All changes
to expression can be made at a central location. Ex: Expression builder for con
nection strings.
Expression builders are extensible. You can define custom Expressions that call
your custom expression handler to return a value that will be substituted at run
time.
Expression builder syntax is language neutral. You can same syntax across univer
sal .Net languages
Expression builder offers both design time support as well as parse-time support
. Design time support means you can built expression using Expression Dialog whe
n accessed using properties window of control.
Expression builder can also be constructed to support
The syntax for Expression builders is as follows:
<%$ expression prefix: expression value %>
The dollar sign ($) indicates to ASP.NET that an expression follows. The express
ion prefix defines the type of expression, such as AppSettings, ConnectionString
s, or String resources. Following the colon (:) is the actual expression value t
hat ASP.NET will substitute at run time.
<asp:Button ID="Button1" runat="server" Text='<%$Appsettings:ButtonName %>'/>

<appSettings>
<add key="ButtonName" value="ExpressionBuilder"/>
</appSettings>
Types of Expression builders
ASP.NET 2.0 is shipped with three different built in Expression builders.
AppSettingsExpressionBuilder: This Expression retrieves user defined key-value p
airs defined in AppSettings section of configuration file.
ConnectionStringsExpressionBuilder: This Expression retrieves connection strings
defined in ConnectionStrings section of configuration file.
ResourceExpressionBuilder: This deals with referencing string resources when loc
alizing applications. Appropriate values are substituted at run time based on lo
cale.
Project Object:
In earlier version there were session,cookies etc to uniquely identify the user,
but here in ASP.NET 2.0 a new concept named Profile is introduced.
Like as session:
Session["SessionName"]=value;
We can't use Profile in the same way.
By default ASP.NET Web Profile saved in SQL Server 2005 database and hence it lo
oks under App_Data to find the database. To use Profile object we have to write
some command on .NET command prompt.
Go to Visual Sdudio 2005 command prompt, here type aspnet_regsql.exe. Which will
open a wizard. This wizard has many step to configure SQL Server database for
storing information for ASP.NET application services. Wizard will ask you which
database do you want to use. After finishing the wizard, we have some task in W
eb.config file.
class A
{
public A()
{
};
public int i;
}
class TestPerson
{
static void Main()
{
A a = new A();
A b;
a.i =5;
b=a; // not a deep copy
b.i = a.i+6;
}
}
here a.i=11 and b.i = 11 because a and b both refer same
instance of object
Deep copy would be implemented in c# using copy construction
class A
{
public A()
{
};
public A(A previouscopy)
{
i = previouscopy.i;
};
public int i;
}
class TestPerson
{
static void Main()
{
A a = new A();
a.i =5;
// Create another new object, copying a.
A b = new A(a); // Deep copy using copy constructor
b.i = a.i+6;
}
}
here a.i=5 and b.i = 11 because a and b both refer it's own
instance of object

How would one do a deep copy in .NET?
The First Approach.
1.Create a new instance.
2.Copy the properties from source instance to newly created instance.
[Use reflection if you want to write a common method to achive this]
The Second Approach.
1. Serialize the object and deserialize the output.
: Use binary serialization if you want private variables to be copied.
: Use xml Serialization if you dont want private variable to be copied.
About trusted and untrusted definition in Sql server with ASp.NET?
1)Windows Authentication: It is trusted because the username and password are va
lidated with the Active Directory.
2)SQL Server authentication: It is untrusted, because SQL Server is the only ver
ifier taking part in the transaction.
using System;
class Program
{
static void Main()
{
// Convert string to number.
string text = "500";
int num = int.Parse(text);
Console.WriteLine(num);
}
}
cursors:
A point to context area which has infromation for Oracle to
process SQL statements.
Cursors allow to fetch rows returned by a select statement.
Implicit cursor: Automatically declared
Explicit cursor: defined by programmer

S-ar putea să vă placă și