初始化上传
This commit is contained in:
54
常用工具集/Utility/SqlFormat/FormatStyle.cs
Normal file
54
常用工具集/Utility/SqlFormat/FormatStyle.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
namespace NHibernate.AdoNet.Util
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class FormatStyle
|
||||
{
|
||||
public static readonly FormatStyle Basic = new FormatStyle("basic", new BasicFormatter());
|
||||
public static readonly FormatStyle Ddl = new FormatStyle("ddl", new DdlFormatter());
|
||||
public static readonly FormatStyle None = new FormatStyle("none", new NoFormatImpl());
|
||||
|
||||
private FormatStyle(string name, IFormatter formatter)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Formatter = formatter;
|
||||
}
|
||||
|
||||
public bool Equals(FormatStyle other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (object.ReferenceEquals(this, other) || object.Equals(other.Name, this.Name));
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.Equals(obj as FormatStyle);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (this.Name == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return this.Name.GetHashCode();
|
||||
}
|
||||
|
||||
public IFormatter Formatter { get; private set; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
|
||||
private class NoFormatImpl : IFormatter
|
||||
{
|
||||
public string Format(string source)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user