|
From the MSDN Gospel:
Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information.
Metadata is binary information describing your program that is stored either in a common language runtime portable executable (PE) file or in memory. When you compile your code into a PE file, metadata is inserted into one portion of the file, while your code is converted to Microsoft intermediate language (MSIL) and inserted into another portion of the file. Every type and member defined and referenced in a module or assembly is described within metadata. When code is executed, the runtime loads metadata into memory and references it to discover information about your code's classes, members, inheritance, and so on.
In short, Metadata describes stuff your code, and what it references, down to the member level of each class and module. A Manifest describes higher-level assemby information and contains the metadata for everything in each assembly.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I need to redirect my application to run on the latest version of the .NET runtime available on a machine.
Does anyone have any idea how I could do this WITHOUT using a configuration file.
I saw an application that does that, it's called "netz" (a .NET application compressor)
The application is available at this url: http://www.madebits.com/netz/download.php
If I run that application with both .NET 2.0 and .NET 1.1 it will run on 2.0, but if I have only .NET 1.1 it will run on 1.1 aswell and it doesn't have a netz.exe.config file.
Thanks a lot
-- modified at 5:38 Monday 9th January, 2006
|
|
|
|
|
iis configuration mmc plugin's virtual dir property page has a tab called asp.net that maps which runtime to work in. just Control panel-> administrative tools-> iis -> select virtual dir and right click ; in menu properties the tab with asp.net look at it....(it configures by writing to directories' web.config)
Mikail Çetinkaya . The C# DEveloper
|
|
|
|
|
Ok but I was talking about desktop applications not web applications.
|
|
|
|
|
There's nothing to tell it to use the latest Framework version. This happens automatically, if the version of the .NET Framework that built the application is not installed. More information can be found here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I don't think it's possible without a config file.
The "secret" of netz is that it is compiled for .NET 1.0. Since you don't have that version on your machine, the newest available version is used instead.
|
|
|
|
|
I want to use a string from WebApplication1.aspx.cs in the WebApplication1.aspx code behind (javascript).
|
|
|
|
|
Put a literal control in the javascript code:
var bananas = '<asp:Literal id="Fruit" runat="server"/>';
Then put the string value in the literal, encoded as a javascript string:
Fruit.Text = theString.Replace(@"\", @"\\").Replace("'", @"\'");
---
b { font-weight: normal; }
|
|
|
|
|
I assume Fruit.Text is a ASP.NET textbox.
How do I get the text inside the textbox into bananas
|
|
|
|
|
No, Fruit is not a textbox, it's the Literal element inside the javascript code.
---
b { font-weight: normal; }
|
|
|
|
|
How do I get bananas = Fruit.text
|
|
|
|
|
That is what the javascript code does.
---
b { font-weight: normal; }
|
|
|
|
|
Dear all,
I have developed a .NET dll. I wants to use this dll in Win32(Delphi) applications. Is it possible to do the same.
The data type of arguments passed to the functions in the dll & returned from it are compatible. The return type is a byte array & the arguments passed are string. But, when i used this dll in a Win32 application(developed using Delphi), EAccessViolation exception occurs.
Can anyone suggest me how to use the .net dll in win32 applications?
Thanks & regards,
Abhilash
|
|
|
|
|
I'm afraid that's not possible, unless you can host the CLR inside your application. Be warned that it's not for the faint hearted. This[^] link describes how you can do that.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote: I'm afraid that's not possible, unless you can host the CLR inside your application. Be warned that it's not for the faint hearted. This[^] link describes how you can do that.
Why not just use CCW?
Regards,
Nish
|
|
|
|
|
You're right, CCW is the way to go. "Win32 Applications" put me off track, I mistakenly inferred he didn't want to use COM.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I got a question about Transaction in .Net Framework 2.0.
I have two tables named Bank and Bank2, both with the same schema, column1 Account and column2 Money.
The below is my code.
======================= Bank class =======================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Transactions;
using System.Configuration;
using System.Data.SqlClient;
namespace Sample1
{
class Bank
{
string bankName = string.Empty; // Bank name (Bank or Bank2)
string account; // User Name within Bank table
public Bank(string bankName , string account)
{
this.bankName = bankName;
this.account = account;
}
///
/// Withdraw money from bank
///
/// <param name="amount" />Amount to withdraw
public void Withdraw(decimal amount)
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
try
{
string connectionString = ConfigurationManager.ConnectionStrings["Sample1.Properties.Settings.WYDConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
string cmdText = string.Format("UPDATE [dbo].[{0}] SET [Money] = [Money] - @Money WHERE ([Account] = @Account)" , this.bankName);
cmd.CommandText = cmdText;
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Account" , System.Data.SqlDbType.VarChar , 50 , "Account"));
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Money" , System.Data.SqlDbType.Money , 8 , "Money"));
cmd.Parameters["@Account"].Value = this.account;
cmd.Parameters["@Money"].Value = amount;
conn.Open();
cmd.ExecuteNonQuery();
scope.Complete();
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}
}
catch (Exception)
{
throw;
}
}
}
///
/// Deposit money from Bank
///
/// <param name="amount" />Amount to deposit
public void Deposit(decimal amount)
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
try
{
string connectionString = ConfigurationManager.ConnectionStrings["Sample1.Properties.Settings.WYDConnectionString"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
string cmdText = string.Format("UPDATE [dbo].[{0}] SET [Money] = [Money] + @Money WHERE ([Account] = @Account)" , this.bankName);
cmd.CommandText = cmdText;
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Account" , System.Data.SqlDbType.VarChar , 50 , "Account"));
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Money" , System.Data.SqlDbType.Money , 8 , "Money"));
cmd.Parameters["@Account"].Value = this.account;
cmd.Parameters["@Money"].Value = amount;
conn.Open();
cmd.ExecuteNonQuery();
scope.Complete();
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}
}
catch (Exception)
{
throw;
}
}
}
}
}
==========================================================================
========================== Logic layer ===================================
using (TransactionScope scope = new TransactionScope())
{
try
{
string userName = "Calvin";
int amount = int.Parse(this.textBox1.Text);
Bank bank1 = new Bank("Bank" , userName);
Bank bank2 = new Bank("Bank2" , userName);
bank1.Withdraw(amount);
bank2.Deposit(amount);
scope.Complete();
MessageBox.Show("Done");
}
catch (Exception ex)
{
MessageBox.Show("Error\r\n" + ex.Message , "Error" , MessageBoxButtons.OK ,
MessageBoxIcon.Error , MessageBoxDefaultButton.Button1);
}
}
==========================================================================
The question is that: if I comment out scope.Complete() from Bank class's Withdraw or Deposit methods, just to simulate error occurs. I will get TransactionAbortedException even the whole code is within a try catch block.
I am not sure if I am making mistake or ...
Can anyone help ?
Thanks
|
|
|
|
|
If you move using blocks inside try blocks maybe will work.
who dares wins!
|
|
|
|
|
Is there any way to get reference of the caller function? In a program, a function calls to another which further calls to some other function and so on. In any function, is it possible that which function transferred controlled to current function?
In .NET we can get the current function name using MethodInfo.GetCurrentMethod but this class (MethodInfo) doesn't support the parent function info which called this current method. We need to get that; Any suggestion/help will be appreciated.
Thanks,
Sameers
Need custom software? Contact DevelopersINN[^]
Need to add reminders for your Outlook emails? Try Outlook PA[^]
|
|
|
|
|
Normally, a method shouldn't be bothered with things like which method is calling it. Why do you think that you need that?
The information is in the call stack. One method of getting that is to throw an exception and catch it, then you get an exception object that contains an analysis of the call stack. Not a very efficient method, though.
---
b { font-weight: normal; }
-- modified at 4:23 Sunday 8th January, 2006
|
|
|
|
|
|
Thanks for the link. It works. Great.
Thanks again,
Need custom software? Contact DevelopersINN[^]
Need to add reminders for your Outlook emails? Try Outlook PA[^]
|
|
|
|
|
Hi, I can't find any documentation about inserting other controls (for example a linkLabel) to a DataGrid. All I know is that I have to inherit from DataGridColumnStyle class and override some methods. The question is how to do it? What methods have to be overriden? I've seen the article about putting a combobox in a DG but I don't find it satisfying.
_slav_
|
|
|
|
|
By definition, the articles on putting a combobox in a grid will contain all the code you need, no matter how satisfying they may or may not appear.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is there a way to handle WM_SYSCOMMAND (specifically SC_CLOSE ) in a Windows Forms application other than handling the Closing event?
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|