Is it the case that calling a static field via the embedded API does not cause the static constructor to be run? This seems to be the behaviour I am observing.
In the example below setting the static MetaDataXXX fields (before any other static access) does not cause the static constructor to be run and expected behaviour is lost. If I call a static warmup method first, which does trigger the constructor, then all is well. According to the example at the bottom of this page accessing a public static field should kick off the static constructor. http://msdn.microsoft.com/en-us/library/aa645612(v=vs.71).aspx The issue has some complexities though: http://csharpindepth.com/Articles/General/BeforeFieldInit.aspx public partial class Entities { public static string MetaDataProvider = null; public static string MetaDataFormat = null; // Static constructor static Entities() { MetaDataProvider = "System.Data.SQLite"; MetaDataFormat = string.Format(@"metadata=res://{0}/BrightPay.csdl|res://{0}/BrightPay.ssdl|res://{0}/BrightPay.msl;provider={1}", Assembly.GetAssembly(typeof(Entities)).FullName, Entities.MetaDataProvider); Console.WriteLine ("Entities static ctor. MetaDataFormat = {0}", MetaDataFormat); } } Jonathan _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
