23rd August 2007, 04:44 pm
Creating a class from a string might be crucial for some very dynamic projects. It’s a single line of code that I wanted to share but I think it has a lot of power.
Simply get the executing assembly and call the GetType method. If your assembly is one of the linked assembly or even a dynamically loaded assembly, you might need to call GetReferencedAssemblies() method as well.
namespace reflectme
{
using System;
public class hello
{
public hello()
{
Console.WriteLine("hello");
Console.ReadLine();
}
static void Main(string[] args)
{
Type t = System.Reflection.Assembly.GetExecutingAssembly().GetType("reflectme.hello");
t.GetConstructor(System.Type.EmptyTypes).Invoke(null);
}
}
}
Bear in mind it will be extremely slow. Don’t do that
7th August 2007, 01:57 am
It’s getting even more interesting. With the efforts of LINQ to be the solution for entity relationship now Microsoft adds additional features with Astoria services. Although it looks like an independent product, it has a dependency with ADO.Net Entity Framework (System.Data.Entity) which is not included in ORCAS Beta 2 and also not available for beta 2. So I couldn’t play with it.
Astoria as announced is a database service that supports different protocols and standards. At first it looks like Amazon S3 web service, but you can also host it yourself. Why would you want to host it? I don’t think this model would be useful for .NET applications, although you can, why to use another layer. Presumably it’s for Javascript and Silverlight usage mainly, you don’t need any additional libraries, it’s all there as a REST web service. Currently 100MB is provided by Astoria site…
I wonder if the web is going to provide enterprise services sooner or later. Although we store all our e-mail, calendar in the web, I still use my hosting database server or local cache rather than web services. Anyway I like the web relational database idea… I hope to play in the next release.
Tags:
100mb,
amazon,
astoria,
database_service,
entity_relationship,
linq,
orcas,
relational_database,
s3_web,
Silverlight,
Software,
Uncategorized,
web_service Category:
Silverlight,
Software,
Uncategorized |
Comment