public static void CreateContainerMappings(ArrayList objectList) { ContainerMappingSet cms = new ContainerMappingSet(); foreach (XmlNode node in objectList) { ContainerMapping cm; cm = new ContainerMapping(node); cms[cm.ContainerMappingId] = cm; } containerMapSet = cms; CMPProfile.DbTypeHints["VarChar"] = System.Data.SqlDbType.VarChar; CMPProfile.DbTypeHints["Int"] = System.Data.SqlDbType.Int; CMPProfile.DbTypeHints["DateTime"] = System.Data.SqlDbType.DateTime; CMPProfile.DbTypeHints["Text"] = System.Data.SqlDbType.Text; CMPProfile.DbTypeHints["Bit"] = System.Data.SqlDbType.Bit; CMPProfile.DbTypeHints["Money"] = System.Data.SqlDbType.Money; CMPProfile.DbTypeHints["Binary"] = System.Data.SqlDbType.Binary; CMPProfile.DbTypeHints["VarBinary"] = System.Data.SqlDbType.Image; CMPProfile.DbTypeHints["Float"] = System.Data.SqlDbType.Float; CMPProfile.DbTypeHints["Image"] = System.Data.SqlDbType.Image; CMPProfile.DbTypeHints["UniqueIdentifier"] = System.Data.SqlDbType.UniqueIdentifier; }
public override void Execute(string containerMappingId, string commandName) { ContainerMapping containerMapping = CMPConfigurationHandler.ContainerMaps[containerMappingId]; if (containerMapping == null) { throw new ContainerMappingNotFoundException(containerMappingId); } CommandMapping commandMapping = containerMapping.CommandMappingList[commandName] as CommandMapping; if (commandMapping == null) { throw new CommandMappingNotFoundException(containerMappingId, commandName); } SqlCommand currentCommand = BuildCommandFromMapping(commandMapping); currentCommand.Connection.Open(); currentCommand.ExecuteNonQuery(); currentCommand.Connection.Close(); currentCommand.Connection.Dispose(); currentCommand.Dispose(); }
public static void CreateContainerMappings(StringCollection mappingFileCollection) { ContainerMappingSet cms = new ContainerMappingSet(); XmlDocument doc = new XmlDocument(); foreach (string fileName in mappingFileCollection) { doc.Load(fileName); XmlNodeList containerMappingNodeList = doc.SelectNodes("//ContainerMapping"); ContainerMapping cm; foreach (XmlNode containerMappingNode in containerMappingNodeList) { cm = new ContainerMapping(containerMappingNode); cms[cm.ContainerMappingId] = cm; } } containerMapSet = cms; CMPProfile.DbTypeHints["VarChar"] = System.Data.SqlDbType.VarChar; CMPProfile.DbTypeHints["Int"] = System.Data.SqlDbType.Int; CMPProfile.DbTypeHints["DateTime"] = System.Data.SqlDbType.DateTime; CMPProfile.DbTypeHints["Text"] = System.Data.SqlDbType.Text; CMPProfile.DbTypeHints["Bit"] = System.Data.SqlDbType.Bit; CMPProfile.DbTypeHints["Money"] = System.Data.SqlDbType.Money; CMPProfile.DbTypeHints["Binary"] = System.Data.SqlDbType.Binary; CMPProfile.DbTypeHints["VarBinary"] = System.Data.SqlDbType.Image; CMPProfile.DbTypeHints["Float"] = System.Data.SqlDbType.Float; CMPProfile.DbTypeHints["Image"] = System.Data.SqlDbType.Image; CMPProfile.DbTypeHints["UniqueIdentifier"] = System.Data.SqlDbType.UniqueIdentifier; }
public override void Execute(string containerMappingId, string commandName, PersistableObject currentObject) { if (currentObject == null) { throw new PersistableObjectNullException(); } ContainerMapping containerMapping = CMPConfigurationHandler.ContainerMaps[containerMappingId]; if (containerMapping == null) { throw new ContainerMappingNotFoundException(containerMappingId); } CommandMapping commandMapping = containerMapping.CommandMappingList[commandName] as CommandMapping; if (commandMapping == null) { throw new CommandMappingNotFoundException(containerMappingId, commandName); } SqlCommand currentCommand = BuildCommandFromMapping(commandMapping); AssignValuesToParameters(commandMapping, ref currentCommand, currentObject); currentCommand.Connection.Open(); AssignReturnValueToDataSet(currentCommand, ref currentObject); AssignOutputValuesToInstance(commandMapping, currentCommand, ref currentObject); AssignReturnValue(currentCommand, currentObject); currentCommand.Connection.Close(); currentCommand.Connection.Dispose(); currentCommand.Dispose(); }