/// <summary> /// 将数据返回为DataTable /// </summary> /// <returns></returns> public DataTable AsDataTable() { DataTable dt = new DataTable(this.Name); int beginCol = this.Address.StartColumn; foreach (TableColumn excelColumn in this.Columns) { Type columnDataType = typeof(string); string dataType = excelColumn.GetAttribute("dataType"); if (dataType != null) { columnDataType = TypeCreator.GetTypeInfo(dataType); } dt.Columns.Add(excelColumn.Name, columnDataType); } foreach (TableRow tr in this.Rows) { DataRow dr = dt.NewRow(); foreach (TableColumn Col in this.Columns) { dr[Col.Name] = tr[Col].Value; } dt.Rows.Add(dr); } return(dt); }
/// <summary> /// /// </summary> public void Start() { Type type = TypeCreator.GetTypeInfo(_typeDesp); this._host = new ServiceHost(type); this._host.Open(); }
private string GetResResource(string originalPath) { string resPath = originalPath.Substring("res://".Length); string[] parts = resPath.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); ExceptionHelper.FalseThrow(parts.Length >= 2, Resources.DeluxeWebResource.E_InvalidContentLogoImagePath, originalPath); System.Type type = TypeCreator.GetTypeInfo(parts[0].Trim()); return(GetPageHandler().ClientScript.GetWebResourceUrl(type, parts[1].Trim())); }
/// <summary> /// 得到System.Type信息 /// </summary> /// <returns></returns> public Type GetTypeInfo() { if (this.typeInfo == null) { if (this.Type.IsNotEmpty()) { this.typeInfo = TypeCreator.GetTypeInfo(this.Type); } } return(this.typeInfo); }
private System.Type GetActualType(DataType originalType) { System.Type actualType = typeof(System.String); DataTypeDescriptionAttribute typeDesp = AttributeHelper.GetCustomAttribute <DataTypeDescriptionAttribute>(originalType.GetType().GetField(originalType.ToString())); if (typeDesp != null && typeDesp.TypeDescription.IsNotEmpty()) { actualType = TypeCreator.GetTypeInfo(typeDesp.TypeDescription); } return(actualType); }
/// <summary> /// 从XmlReader中读取 /// </summary> /// <param name="reader">Xml阅读器对象</param> /// <param name="type">对象类型</param> public void ReadFromXml(XmlReader reader, System.Type type) { ExceptionHelper.FalseThrow <ArgumentNullException>(reader != null, "reader"); ExceptionHelper.FalseThrow <ArgumentNullException>(type != null, "type"); this.Clear(); Dictionary <string, MemberInfo> miDict = GetMemberInfoDict(type); while (reader.EOF == false) { reader.Read(); if (reader.IsStartElement("ORMapping")) { this.tableName = XmlHelper.GetAttributeValue(reader, "tableName", string.Empty); this.QueryTableName = XmlHelper.GetAttributeValue(reader, "queryTableName", string.Empty); reader.ReadToDescendant("Item"); } if (reader.IsStartElement("Item")) { string propName = reader.GetAttribute("propertyName"); string subClassPropertyName = reader.GetAttribute("subClassPropertyName"); string subClassTypeDescription = reader.GetAttribute("subClassTypeDescription"); MemberInfo mi = null; if (miDict.TryGetValue(propName, out mi)) { if (string.IsNullOrEmpty(subClassPropertyName) == false) { if (string.IsNullOrEmpty(subClassTypeDescription) == false) { mi = ORMapping.GetSubClassMemberInfoByName(subClassPropertyName, TypeCreator.GetTypeInfo(subClassTypeDescription)); } else { mi = ORMapping.GetSubClassMemberInfoByName(subClassPropertyName, mi); } } if (mi != null) { ReadItemFromXml(reader, type, mi); } } } } }
protected override void LoadClientState(string clientState) { object[] state = JSONSerializerExecute.Deserialize <object[]>(HttpUtility.UrlDecode(clientState)); if (state[1] != null) { string typeDesp = (string)state[1]; if (string.IsNullOrEmpty(typeDesp) == false && state[0] != null) { Type type = TypeCreator.GetTypeInfo(typeDesp); this.initialData = (IList)JSONSerializerExecute.DeserializeObject(state[0], type); } } }
private static void ClearCacheQueue(string queueTypeName) { if (queueTypeName.IsNotEmpty()) { if (queueTypeName == "ClearAllCache") { CacheManager.ClearAllCache(); } else { Type type = TypeCreator.GetTypeInfo(queueTypeName); CacheManager.GetInstance(type).Clear(); } } }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected SerializableEditableKeyedDataObjectCollectionBase(SerializationInfo info, StreamingContext context) { ArrayList list = (ArrayList)info.GetValue("List", typeof(ArrayList)); string comparerTypeDesp = info.GetString("ComparerType"); if (comparerTypeDesp.IsNotEmpty()) { Type comparerType = TypeCreator.GetTypeInfo(comparerTypeDesp); this._Comparer = (IEqualityComparer)info.GetValue("Comparer", comparerType); } foreach (TItem obj in list) { base.Add(obj); } }
/// <summary> /// 从XML还原对象 /// </summary> /// <param name="node">XML节点</param> public override void FromXmlNode(XmlNode node) { ExceptionHelper.TrueThrow <ArgumentNullException>(node == null, "node"); base.FromXmlNode(node); this.sortID = XmlHelper.GetAttributeValue <int>(node, "sortID", 0); this.objectType = typeof(object); string typeName = XmlHelper.GetAttributeValue <string>(node, "objectType", string.Empty); if (!string.IsNullOrEmpty(typeName)) { this.objectType = TypeCreator.GetTypeInfo(typeName); } this.oldValue = XmlHelper.GetAttributeValue <string>(node, "oldValue", string.Empty); this.newValue = XmlHelper.GetAttributeValue <string>(node, "newValue", string.Empty); }
/// <summary> /// 渲染每一条Cache项 /// </summary> /// <param name="writer"></param> /// <param name="queueInfo"></param> private static void RenderCacheQueueItemsInfo(HtmlTextWriter writer, CacheQueueInfo queueInfo) { Type type = TypeCreator.GetTypeInfo(queueInfo.QueueTypeFullName); CacheQueueBase cacheQueue = CacheManager.GetInstance(type); CacheItemInfoCollection itemsInfo = cacheQueue.GetAllItemsInfo(); foreach (CacheItemInfo itemInfo in itemsInfo) { writer.WriteBeginTag("div"); writer.WriteAttribute("class", "queueInfoDetail"); writer.Write(">"); writer.Write(HttpUtility.HtmlEncode(string.Format("Key={0}, Value={1}", itemInfo.Key, itemInfo.Value))); writer.WriteEndTag("div"); } }
private static IDictionary <string, object> LoadExtDataFromRawExtData(string raw) { IDictionary <string, object> result = new Dictionary <string, object>(); if (string.IsNullOrEmpty(raw) == false) { XmlDocument xmlDoc = XmlHelper.CreateDomDocument(raw); foreach (XmlNode elem in xmlDoc.DocumentElement) { string typeDesc = XmlHelper.GetAttributeValue(elem, "type", "System.String"); object defaultValue = TypeCreator.GetTypeDefaultValue(TypeCreator.GetTypeInfo(typeDesc)); result.Add(XmlHelper.GetAttributeText(elem, "key"), XmlHelper.GetAttributeValue(elem, "value", defaultValue)); } } return(result); }
/// <summary> /// 得到对象的属性类型 /// </summary> /// <returns></returns> public Type GetObjectValueType() { this.ObjectValueTypeDescription.CheckStringIsNullOrEmpty("objectValueTypeDescription"); return(TypeCreator.GetTypeInfo(this.ObjectValueTypeDescription)); }