⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbresource.cs

📁 NHibernate NET开发者所需的
💻 CS
字号:
using System.Collections.Generic;

namespace NHibernate.Test.NHSpecificTest.NH1408
{
	public abstract class DbResource : Entity
	{
		private readonly IList<DbResourceKey> keys = new List<DbResourceKey>();
		private string rawValue;

		protected virtual string RawValue
		{
			get { return rawValue; }
			set { rawValue = value; }
		}

		public virtual IEnumerable<DbResourceKey> Keys
		{
			get { return keys; }
		}

		public abstract object Value { get; set; }

		public virtual void AddKey(DbResourceKey key)
		{
			if (keys.Contains(key))
			{
				return;
			}
			keys.Add(key);
			key.Resource = this;
		}
	}

	internal class StringDbResource : DbResource
	{
		protected StringDbResource() {}

		public StringDbResource(string key, string language, string value)
		{
			AddKey(new DbResourceKey(key, language));
			Value = value;
		}

		public override object Value
		{
			get { return RawValue; }
			set { RawValue = (string) value; }
		}
	}

	internal class IntDbResource : DbResource
	{
		protected IntDbResource() {}

		public IntDbResource(string key, int xml)
		{
			AddKey(new DbResourceKey(key));
			Value = xml;
		}

		public override object Value
		{
			get { return int.Parse(RawValue); }
			set { RawValue = ((int) value).ToString(); }
		}
	}

	internal class DecimalDbResource : DbResource
	{
		protected DecimalDbResource() {}

		public DecimalDbResource(string key, decimal xml)
		{
			AddKey(new DbResourceKey(key));
			Value = xml;
		}

		public override object Value
		{
			get { return decimal.Parse(RawValue); }
			set { RawValue = ((decimal) value).ToString(); }
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -