public void BailsWhenNotConfigured() { ServicedComponentExporter exp = new ServicedComponentExporter(); try { exp.AfterPropertiesSet(); Assert.Fail("Did not throw expected ArgumentException!"); } catch (ArgumentException) { } }
public void BailsWhenNotConfigured() { ServicedComponentExporter exp = new ServicedComponentExporter(); try { exp.AfterPropertiesSet(); Assert.Fail("Did not throw expected ArgumentException!"); } catch (ArgumentException) { } }
public void RegistersSimpleObjectWithNonDefaultTransactionOption() { ServicedComponentExporter exp = new ServicedComponentExporter(); exp.TargetName = "objectTest"; exp.ObjectName = "objectTestProxy"; exp.TypeAttributes = new ArrayList(); exp.TypeAttributes.Add(new TransactionAttribute(TransactionOption.RequiresNew)); exp.AfterPropertiesSet(); Type type = CreateWrapperType(exp, typeof(TestObject), false); TransactionAttribute[] attrs = (TransactionAttribute[])type.GetCustomAttributes(typeof(TransactionAttribute), false); Assert.AreEqual(1, attrs.Length); Assert.AreEqual(TransactionOption.RequiresNew, attrs[0].Value); }
public void RegistersManagedObjectWithNonDefaultTransactionOption() { ServicedComponentExporter exp = new ServicedComponentExporter(); exp.TargetName = "objectTest"; exp.ObjectName = "objectTestProxy"; exp.TypeAttributes = new ArrayList(); exp.TypeAttributes.Add(new TransactionAttribute(TransactionOption.RequiresNew)); exp.AfterPropertiesSet(); Type type = CreateWrapperType(exp, typeof(TestObject), true); TransactionAttribute[] attrs = (TransactionAttribute[])type.GetCustomAttributes(typeof(TransactionAttribute), false); Assert.AreEqual(1, attrs.Length); Assert.AreEqual(TransactionOption.RequiresNew, attrs[0].Value); }
private Type ExportObject(EnterpriseServicesExporter exporter, FileInfo assemblyFile, IConfigurableApplicationContext appCtx, string objectName) { exporter.ObjectFactory = appCtx.ObjectFactory; exporter.Assembly = Path.GetFileNameWithoutExtension(assemblyFile.Name); exporter.ApplicationName = exporter.Assembly; exporter.AccessControl = new ApplicationAccessControlAttribute(false); exporter.UseSpring = true; ServicedComponentExporter exp = new ServicedComponentExporter(); exp.TargetName = objectName; exp.ObjectName = objectName + "Service"; exp.TypeAttributes = new ArrayList(); exp.TypeAttributes.Add(new TransactionAttribute(TransactionOption.RequiresNew)); exp.AfterPropertiesSet(); exporter.Components.Add(exp); Assembly assembly = exporter.GenerateComponentAssembly(assemblyFile); exporter.RegisterServicedComponents(assemblyFile); return(assembly.GetType(objectName + "Service")); }
private Type ExportObject(EnterpriseServicesExporter exporter, FileInfo assemblyFile, IConfigurableApplicationContext appCtx, string objectName) { exporter.ObjectFactory = appCtx.ObjectFactory; exporter.Assembly = Path.GetFileNameWithoutExtension(assemblyFile.Name); exporter.ApplicationName = exporter.Assembly; exporter.AccessControl = new ApplicationAccessControlAttribute(false); exporter.UseSpring = true; ServicedComponentExporter exp = new ServicedComponentExporter(); exp.TargetName = objectName; exp.ObjectName = objectName + "Service"; exp.TypeAttributes = new ArrayList(); exp.TypeAttributes.Add(new TransactionAttribute(TransactionOption.RequiresNew)); exp.AfterPropertiesSet(); exporter.Components.Add(exp); Assembly assembly = exporter.GenerateComponentAssembly(assemblyFile); exporter.RegisterServicedComponents(assemblyFile); return assembly.GetType(objectName + "Service"); }