Skip to content

Class EntityBuilder ​

Namespace: Tool.Utils
Assembly: Tool.Net.dll

用于提高,对象构造(只支持无参构造),对象取值,对象赋值。

csharp
public class EntityBuilder

Inheritance ​

object ← EntityBuilder

Inherited Members ​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods ​

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Remarks ​

代码由逆血提供支持

Constructors ​

EntityBuilder(Type) ​

创建构造模型对象

csharp
public EntityBuilder(Type classtype)

Parameters ​

classtype Type

Properties ​

ClassType ​

对象原型

csharp
public Type ClassType { get; }

Property Value ​

Type

IsNew ​

是否可以构造

csharp
public bool IsNew { get; }

Property Value ​

bool

KeyParameters ​

获取当前类所有字段字典

csharp
public IDictionary<string, PropertyInfo> KeyParameters { get; }

Property Value ​

IDictionary<string, PropertyInfo>

New ​

获取对象

csharp
public object New { get; }

Property Value ​

object

Parameters ​

对象下公开的字段

csharp
public PropertyInfo[] Parameters { get; }

Property Value ​

PropertyInfo[]

Methods ​

Get(object) ​

获取对象的字典数据

csharp
public IDictionary<string, object> Get(object _class)

Parameters ​

_class object

对象原型

Returns ​

IDictionary<string, object>

字典

GetEntity(Type) ​

获取 对象 模型

csharp
public static EntityBuilder GetEntity(Type type)

Parameters ​

type Type

对象类型

Returns ​

EntityBuilder

实体模型

GetEntity(object) ​

获取 对象 模型

csharp
public static EntityBuilder GetEntity(object _class)

Parameters ​

_class object

对象

Returns ​

EntityBuilder

实体模型

GetParameterType(string, out Type) ​

根据字段名获取字段类型

csharp
public bool GetParameterType(string name, out Type type)

Parameters ​

name string

字段名

type Type

字段类型

Returns ​

bool

是否查找到

Set(object, IDictionary<string, object>) ​

赋值对象

csharp
public void Set(object _class, IDictionary<string, object> parameters)

Parameters ​

_class object

对象原型

parameters IDictionary<string, object>

字典(字典如标记忽略大小写赋值,就能实现特定行为)

基于Apache-2.0协议开源