/// <summary> /// Deserializes the specified node in a <see cref="IDbProvider"/>. /// </summary> /// <param name="node">The node.</param> /// <returns>The <see cref="IDbProvider"/></returns> public static IDbProvider Deserialize(XmlNode node) { IDbProvider provider = new DbProvider(); NameValueCollection prop = NodeUtils.ParseAttributes(node); provider.AssemblyName = prop["assemblyName"]; provider.CommandBuilderClass = prop["commandBuilderClass"]; provider.DbCommandClass = prop["commandClass"]; provider.DbConnectionClass = prop["connectionClass"]; provider.DataAdapterClass = prop["dataAdapterClass"]; provider.Description = prop["description"]; provider.IsDefault = NodeUtils.GetBooleanAttribute(prop, "default", false); provider.IsEnabled = NodeUtils.GetBooleanAttribute(prop, "enabled", true); provider.Name = prop["name"]; provider.ParameterDbTypeClass = prop["parameterDbTypeClass"]; provider.ParameterDbTypeProperty = prop["parameterDbTypeProperty"]; provider.ParameterPrefix = prop["parameterPrefix"]; provider.SetDbParameterPrecision = NodeUtils.GetBooleanAttribute(prop, "setDbParameterPrecision", true); provider.SetDbParameterScale = NodeUtils.GetBooleanAttribute(prop, "setDbParameterScale", true); provider.SetDbParameterSize = NodeUtils.GetBooleanAttribute(prop, "setDbParameterSize", true); provider.UseDeriveParameters = NodeUtils.GetBooleanAttribute(prop, "useDeriveParameters", true); provider.UseParameterPrefixInParameter = NodeUtils.GetBooleanAttribute(prop, "useParameterPrefixInParameter", true); provider.UseParameterPrefixInSql = NodeUtils.GetBooleanAttribute(prop, "useParameterPrefixInSql", true); provider.UsePositionalParameters = NodeUtils.GetBooleanAttribute(prop, "usePositionalParameters", false); provider.AllowMARS = NodeUtils.GetBooleanAttribute(prop, "allowMARS", false); return(provider); }
public static Update Deserialize(XmlNode node, ConfigurationScope configScope) { Update update = new Update(); NameValueCollection attributes = NodeUtils.ParseAttributes(node, configScope.Properties); update.CacheModelName = NodeUtils.GetStringAttribute(attributes, "cacheModel"); update.ExtendStatement = NodeUtils.GetStringAttribute(attributes, "extends"); update.Id = NodeUtils.GetStringAttribute(attributes, "id"); update.ParameterClassName = NodeUtils.GetStringAttribute(attributes, "parameterClass"); update.ParameterMapName = NodeUtils.GetStringAttribute(attributes, "parameterMap"); update.AllowRemapping = NodeUtils.GetBooleanAttribute(attributes, "remapResults", false); int count = node.ChildNodes.Count; for (int i = 0; i < count; i++) { if (node.ChildNodes[i].LocalName == "generate") { Generate generate = new Generate(); NameValueCollection values2 = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); generate.By = NodeUtils.GetStringAttribute(values2, "by"); generate.Table = NodeUtils.GetStringAttribute(values2, "table"); update.Generate = generate; } } return(update); }
/// <summary> /// Deserialize a Procedure object /// </summary> /// <param name="node"></param> /// <param name="configScope"></param> /// <returns></returns> public static Select Deserialize(XmlNode node, ConfigurationScope configScope) { Select select = new Select(); NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties); select.CacheModelName = NodeUtils.GetStringAttribute(prop, "cacheModel"); select.ExtendStatement = NodeUtils.GetStringAttribute(prop, "extends"); select.Id = NodeUtils.GetStringAttribute(prop, "id"); select.ListClassName = NodeUtils.GetStringAttribute(prop, "listClass"); select.ParameterClassName = NodeUtils.GetStringAttribute(prop, "parameterClass"); select.ParameterMapName = NodeUtils.GetStringAttribute(prop, "parameterMap"); select.ResultClassName = NodeUtils.GetStringAttribute(prop, "resultClass"); select.ResultMapName = NodeUtils.GetStringAttribute(prop, "resultMap"); select.AllowRemapping = NodeUtils.GetBooleanAttribute(prop, "remapResults", false); int count = node.ChildNodes.Count; for (int i = 0; i < count; i++) { if (node.ChildNodes[i].LocalName == "generate") { Generate generate = new Generate(); NameValueCollection props = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); generate.By = NodeUtils.GetStringAttribute(props, "by"); generate.Table = NodeUtils.GetStringAttribute(props, "table"); select.Generate = generate; } } return(select); }
public static CacheModel Deserialize(XmlNode node, ConfigurationScope configScope) { CacheModel model = new CacheModel(); NameValueCollection attributes = NodeUtils.ParseAttributes(node, configScope.Properties); model.Id = NodeUtils.GetStringAttribute(attributes, "id"); model.Implementation = NodeUtils.GetStringAttribute(attributes, "implementation"); model.Implementation = configScope.SqlMapper.TypeHandlerFactory.GetTypeAlias(model.Implementation).Class.AssemblyQualifiedName; model.IsReadOnly = NodeUtils.GetBooleanAttribute(attributes, "readOnly", true); model.IsSerializable = NodeUtils.GetBooleanAttribute(attributes, "serialize", false); int count = node.ChildNodes.Count; for (int i = 0; i < count; i++) { if (node.ChildNodes[i].LocalName == "flushInterval") { FlushInterval interval = new FlushInterval(); NameValueCollection values2 = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); interval.Hours = NodeUtils.GetIntAttribute(values2, "hours", 0); interval.Milliseconds = NodeUtils.GetIntAttribute(values2, "milliseconds", 0); interval.Minutes = NodeUtils.GetIntAttribute(values2, "minutes", 0); interval.Seconds = NodeUtils.GetIntAttribute(values2, "seconds", 0); model.FlushInterval = interval; } } return(model); }
/// <summary> /// Deserialize a TypeHandler object /// </summary> /// <param name="node"></param> /// <param name="configScope"></param> /// <returns></returns> public static Delete Deserialize(XmlNode node, ConfigurationScope configScope) { Delete delete = new Delete(); NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties); delete.CacheModelName = NodeUtils.GetStringAttribute(prop, "cacheModel"); delete.ExtendStatement = NodeUtils.GetStringAttribute(prop, "extends"); delete.Id = NodeUtils.GetStringAttribute(prop, "id"); delete.ListClassName = NodeUtils.GetStringAttribute(prop, "listClass"); delete.ParameterClassName = NodeUtils.GetStringAttribute(prop, "parameterClass"); delete.ParameterMapName = NodeUtils.GetStringAttribute(prop, "parameterMap"); delete.ResultClassName = NodeUtils.GetStringAttribute(prop, "resultClass"); delete.ResultMapName = NodeUtils.GetStringAttribute(prop, "resultMap"); delete.AllowRemapping = NodeUtils.GetBooleanAttribute(prop, "remapResults", false); delete.ForceDisabledAutoMapCompatibilityMode = NodeUtils.GetBooleanAttribute(prop, "forceDisabledAutoMapCompatibilityMode", false); delete.ForceEnableAutoMapCompatibilityMode = NodeUtils.GetBooleanAttribute(prop, "forceEnableAutoMapCompatibilityMode", false); int count = node.ChildNodes.Count; for (int i = 0; i < count; i++) { if (node.ChildNodes[i].LocalName == "generate") { Generate generate = new Generate(); NameValueCollection props = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); generate.By = NodeUtils.GetStringAttribute(props, "by"); generate.Table = NodeUtils.GetStringAttribute(props, "table"); delete.Generate = generate; } } return(delete); }
/// <summary> /// Deserialize a Dao object /// </summary> /// <param name="node"></param> /// <param name="configScope"></param> /// <returns></returns> public static DaoSessionHandler Deserialize(XmlNode node, ConfigurationScope configScope) { DaoSessionHandler daoSessionHandler = new DaoSessionHandler(); NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties); daoSessionHandler.Implementation = NodeUtils.GetStringAttribute(prop, "implementation"); daoSessionHandler.Name = NodeUtils.GetStringAttribute(prop, "id"); daoSessionHandler.IsDefault = NodeUtils.GetBooleanAttribute(prop, "default", false); return(daoSessionHandler); }
public static Statement Deserialize(XmlNode node, ConfigurationScope configScope) { Statement statement = new Statement(); NameValueCollection attributes = NodeUtils.ParseAttributes(node, configScope.Properties); statement.CacheModelName = NodeUtils.GetStringAttribute(attributes, "cacheModel"); statement.ExtendStatement = NodeUtils.GetStringAttribute(attributes, "extends"); statement.Id = NodeUtils.GetStringAttribute(attributes, "id"); statement.ListClassName = NodeUtils.GetStringAttribute(attributes, "listClass"); statement.ParameterClassName = NodeUtils.GetStringAttribute(attributes, "parameterClass"); statement.ParameterMapName = NodeUtils.GetStringAttribute(attributes, "parameterMap"); statement.ResultClassName = NodeUtils.GetStringAttribute(attributes, "resultClass"); statement.ResultMapName = NodeUtils.GetStringAttribute(attributes, "resultMap"); statement.AllowRemapping = NodeUtils.GetBooleanAttribute(attributes, "remapResults", false); return(statement); }
public static ResultProperty Deserialize(XmlNode node, ConfigurationScope configScope) { ResultProperty property = new ResultProperty(); NameValueCollection attributes = NodeUtils.ParseAttributes(node, configScope.Properties); property.CLRType = NodeUtils.GetStringAttribute(attributes, "type"); property.CallBackName = NodeUtils.GetStringAttribute(attributes, "typeHandler"); property.ColumnIndex = NodeUtils.GetIntAttribute(attributes, "columnIndex", -999999); property.ColumnName = NodeUtils.GetStringAttribute(attributes, "column"); property.DbType = NodeUtils.GetStringAttribute(attributes, "dbType"); property.IsLazyLoad = NodeUtils.GetBooleanAttribute(attributes, "lazyLoad", false); property.NestedResultMapName = NodeUtils.GetStringAttribute(attributes, "resultMapping"); property.NullValue = attributes["nullValue"]; property.PropertyName = NodeUtils.GetStringAttribute(attributes, "property"); property.Select = NodeUtils.GetStringAttribute(attributes, "select"); return(property); }
/// <summary> /// Deserialize a TypeHandler object /// </summary> /// <param name="node"></param> /// <param name="configScope"></param> /// <returns></returns> public static Insert Deserialize(XmlNode node, ConfigurationScope configScope) { Insert insert = new Insert(); NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties); insert.CacheModelName = NodeUtils.GetStringAttribute(prop, "cacheModel"); insert.ExtendStatement = NodeUtils.GetStringAttribute(prop, "extends"); insert.Id = NodeUtils.GetStringAttribute(prop, "id"); insert.ParameterClassName = NodeUtils.GetStringAttribute(prop, "parameterClass"); insert.ParameterMapName = NodeUtils.GetStringAttribute(prop, "parameterMap"); insert.ResultClassName = NodeUtils.GetStringAttribute(prop, "resultClass"); insert.ResultMapName = NodeUtils.GetStringAttribute(prop, "resultMap"); insert.AllowRemapping = NodeUtils.GetBooleanAttribute(prop, "remapResults", false); insert.ForceDisabledAutoMapCompatibilityMode = NodeUtils.GetBooleanAttribute(prop, "forceDisabledAutoMapCompatibilityMode", false); insert.ForceEnableAutoMapCompatibilityMode = NodeUtils.GetBooleanAttribute(prop, "forceEnableAutoMapCompatibilityMode", false); int count = node.ChildNodes.Count; for (int i = 0; i < count; i++) { if (node.ChildNodes[i].LocalName == "generate") { Generate generate = new Generate(); NameValueCollection props = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); generate.By = NodeUtils.GetStringAttribute(props, "by"); generate.Table = NodeUtils.GetStringAttribute(props, "table"); insert.Generate = generate; } else if (node.ChildNodes[i].LocalName == "selectKey") { SelectKey selectKey = new SelectKey(); NameValueCollection props = NodeUtils.ParseAttributes(node.ChildNodes[i], configScope.Properties); selectKey.PropertyName = NodeUtils.GetStringAttribute(props, "property"); selectKey.SelectKeyType = InsertDeSerializer.ReadSelectKeyType(props["type"]); selectKey.ResultClassName = NodeUtils.GetStringAttribute(props, "resultClass"); insert.SelectKey = selectKey; } } return(insert); }