Column.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Linq.Expressions;
  6. using System.Reflection;
  7. using System.Runtime.Serialization;
  8. using Newtonsoft.Json;
  9. using Newtonsoft.Json.Linq;
  10. namespace InABox.Core
  11. {
  12. public interface IColumn
  13. {
  14. string Property { get; }
  15. Expression Expression { get; }
  16. Type Type { get; }
  17. }
  18. public static class Column
  19. {
  20. public static IColumn Create(Type concrete, string property)
  21. {
  22. var type = typeof(Column<>).MakeGenericType(concrete);
  23. var result = Activator.CreateInstance(type, property) as IColumn;
  24. return result!;
  25. }
  26. }
  27. public class Column<T> : SerializableExpression<T>, IColumn
  28. {
  29. public Type Type
  30. {
  31. get
  32. {
  33. if (Expression == null)
  34. throw new Exception(string.Format("Expression [{0}] may not be null!", Property));
  35. if (Expression is IndexExpression)
  36. return DatabaseSchema.Property(typeof(T), Property).PropertyType;
  37. return Expression.Type;
  38. }
  39. }
  40. public bool IsEqualTo(string name) =>
  41. !string.IsNullOrWhiteSpace(name) && string.Equals(Property, name);
  42. public bool IsEqualTo(Column<T> column) => string.Equals(Property, column.Property);
  43. public bool IsParentOf(string name) =>
  44. !string.IsNullOrWhiteSpace(name) && name.StartsWith(Property + ".");
  45. public Column()
  46. {
  47. }
  48. public Column(Expression<Func<T, object?>> expression) : base(expression)
  49. {
  50. //String[] parts = expression.ToString().Split(new String[] { "=>" }, StringSplitOptions.RemoveEmptyEntries);
  51. //string property = String.Join(".", parts.Last().Split('.').Skip(1));
  52. //property = property.Replace("Convert(", "").Replace("(","").Replace(")", "");
  53. Property = CoreUtils.GetFullPropertyName(expression, ".");
  54. }
  55. public Column(string property)
  56. {
  57. Property = property;
  58. var iprop = DatabaseSchema.Property(typeof(T), property);
  59. if (iprop != null)
  60. Expression = iprop.Expression();
  61. else
  62. Expression = CoreUtils.CreateMemberExpression(typeof(T), property);
  63. }
  64. public Column<TNew> Cast<TNew>()
  65. where TNew: T
  66. {
  67. return new Column<TNew>(Property);
  68. }
  69. public string Property { get; private set; }
  70. public override void Deserialize(SerializationInfo info, StreamingContext context)
  71. {
  72. }
  73. public override void Serialize(SerializationInfo info, StreamingContext context)
  74. {
  75. }
  76. public static explicit operator Column<T>(Column<Entity> v)
  77. {
  78. var result = new Column<T>();
  79. var exp = CoreUtils.ExpressionToString(typeof(T), v.Expression, true);
  80. result.Expression = CoreUtils.StringToExpression(exp);
  81. result.Property = v.Property;
  82. return result;
  83. }
  84. public override string ToString()
  85. {
  86. var name = Expression.ToString().Replace("x => ", "").Replace("x.", "");
  87. if (Expression.NodeType == System.Linq.Expressions.ExpressionType.Index)
  88. {
  89. var chars = name.SkipWhile(x => !x.Equals('[')).TakeWhile(x => !x.Equals(']'));
  90. name = string.Join("", chars).Replace("[", "").Replace("]", "").Replace("\"", "");
  91. }
  92. return name;
  93. //return Property.ToString();
  94. }
  95. }
  96. public interface IColumns : ISerializeBinary
  97. {
  98. int Count { get; }
  99. bool Any();
  100. IEnumerable<IColumn> GetColumns();
  101. IEnumerable<string> ColumnNames();
  102. Dictionary<String, Type> AsDictionary();
  103. IColumns Add(string column);
  104. IColumns Add(IColumn column);
  105. IColumns Add<T>(Expression<Func<T, object?>> column);
  106. IColumns DefaultColumns(params ColumnType[] types);
  107. }
  108. public enum ColumnType
  109. {
  110. ExcludeVisible,
  111. /// <summary>
  112. /// Do not include <see cref="Entity.ID"/> in the columns.
  113. /// </summary>
  114. ExcludeID,
  115. IncludeOptional,
  116. IncludeForeignKeys,
  117. /// <summary>
  118. /// Include all columns that are accessible through entity links present in the root class.
  119. /// </summary>
  120. IncludeLinked,
  121. IncludeAggregates,
  122. IncludeFormulae,
  123. /// <summary>
  124. /// Include any columns that are a <see cref="CustomProperty"/>.
  125. /// </summary>
  126. IncludeUserProperties,
  127. /// <summary>
  128. /// Include all columns that are accessible through entity links, even nested ones.
  129. /// </summary>
  130. IncludeNestedLinks,
  131. IncludeEditable,
  132. /// <summary>
  133. /// Add all columns that are data actually on the entity, and not on entity links or calculated fields.
  134. /// </summary>
  135. DataColumns,
  136. /// <summary>
  137. /// Add all columns found.
  138. /// </summary>
  139. All
  140. }
  141. public static class Columns
  142. {
  143. public static IColumns Create<T>(Type concrete)
  144. {
  145. if (!typeof(T).IsAssignableFrom(concrete))
  146. throw new Exception($"Columns: {concrete.EntityName()} does not implement {typeof(T).EntityName()}");
  147. var type = typeof(Columns<>).MakeGenericType(concrete);
  148. var result = Activator.CreateInstance(type);
  149. return (result as IColumns)!;
  150. }
  151. public static IColumns Create(Type concrete)
  152. {
  153. var type = typeof(Columns<>).MakeGenericType(concrete);
  154. var result = Activator.CreateInstance(type) as IColumns;
  155. return result!;
  156. }
  157. public static IColumns Create(Type concrete, IEnumerable<string> columns)
  158. {
  159. var type = typeof(Columns<>).MakeGenericType(concrete);
  160. var result = (IColumns)Activator.CreateInstance(type);
  161. foreach (var column in columns)
  162. result.Add(column);
  163. return result;
  164. }
  165. public static IColumns Create(Type concrete, params string[] columns)
  166. {
  167. var type = typeof(Columns<>).MakeGenericType(concrete);
  168. var result = (IColumns)Activator.CreateInstance(type);
  169. foreach (var column in columns)
  170. result.Add(column);
  171. return result;
  172. }
  173. }
  174. public class Columns<T> : IColumns, IEnumerable<Column<T>>
  175. {
  176. private readonly List<Column<T>> columns;
  177. public Columns()
  178. {
  179. columns = new List<Column<T>>();
  180. }
  181. /// <summary>
  182. /// Create a new <see cref="Columns{T}"/>, using <paramref name="columns"/> as the internal list.
  183. /// </summary>
  184. /// <remarks>
  185. /// <paramref name="columns"/> is passed by reference and is stored as the internal list of the <see cref="Columns{T}"/>;
  186. /// hence if one wishes <paramref name="columns"/> to not be modified, one should pass a copy of the list.
  187. /// </remarks>
  188. /// <param name="columns"></param>
  189. public Columns(List<Column<T>> columns)
  190. {
  191. this.columns = columns;
  192. }
  193. public Columns<TNew> Cast<TNew>()
  194. where TNew : T
  195. {
  196. var cols = new Columns<TNew>();
  197. foreach(var column in columns)
  198. {
  199. cols.Add(column.Cast<TNew>());
  200. }
  201. return cols;
  202. }
  203. public override string ToString()
  204. {
  205. return String.Join("; ", columns.Select(x => x.Property));
  206. }
  207. public int IndexOf(String columnname)
  208. {
  209. return ColumnNames().ToList().IndexOf(columnname);
  210. }
  211. public int IndexOf(Expression<Func<T, object>> expression)
  212. {
  213. return ColumnNames().ToList().IndexOf(CoreUtils.GetFullPropertyName(expression,"."));
  214. }
  215. public Columns(params Expression<Func<T, object?>>[] expressions) : this()
  216. {
  217. foreach (var expression in expressions)
  218. columns.Add(new Column<T>(expression));
  219. }
  220. public Columns(IEnumerable<string> properties) : this()
  221. {
  222. foreach (var property in properties)
  223. columns.Add(new Column<T>(property));
  224. }
  225. public Column<T>[] Items
  226. {
  227. get { return columns != null ? columns.ToArray() : new Column<T>[] { }; }
  228. set
  229. {
  230. columns.Clear();
  231. columns.AddRange(value);
  232. }
  233. }
  234. public int Count => columns.Count;
  235. public IEnumerable<IColumn> GetColumns() => columns;
  236. public bool Any() => columns.Any();
  237. public bool Contains(string column) => Items.Any(x => x.IsEqualTo(column));
  238. public bool Contains(Column<T> column) => Items.Any(x => x.IsEqualTo(column));
  239. public IColumns Add(string column)
  240. {
  241. if(CoreUtils.TryGetProperty(typeof(T), column, out var propertyInfo))
  242. {
  243. if (!propertyInfo.PropertyType.GetInterfaces().Contains(typeof(IEnclosedEntity)) &&
  244. !propertyInfo.PropertyType.GetInterfaces().Any(x => x == typeof(IEntityLink)))
  245. {
  246. var exists = columns.Any(x => x.Expression.ToString().Replace("x.", "").Equals(column));
  247. if (!exists)
  248. columns.Add(new Column<T>(column));
  249. }
  250. }
  251. else
  252. {
  253. var prop = DatabaseSchema.Property(typeof(T), column);
  254. if (prop != null)
  255. {
  256. var exists = columns.Any(x => x.Expression.Equals(prop.Expression()));
  257. if (!exists)
  258. columns.Add(new Column<T>(column));
  259. }
  260. }
  261. return this;
  262. }
  263. public Columns<T> AddSubColumns<TSub>(Expression<Func<T, TSub>> super, Columns<TSub>? sub)
  264. {
  265. sub ??= CoreUtils.GetColumns(sub);
  266. var prefix = CoreUtils.GetFullPropertyName(super, ".") + ".";
  267. foreach(var column in sub.ColumnNames())
  268. {
  269. columns.Add(new Column<T>(prefix + column));
  270. }
  271. return this;
  272. }
  273. public IColumns Add<TEntity>(Expression<Func<TEntity, object?>> expression)
  274. {
  275. return Add(CoreUtils.GetFullPropertyName(expression, "."));
  276. }
  277. public Columns<T> Add(Column<T> column)
  278. {
  279. if(!columns.Any(x => x.Property.Equals(column.Property)))
  280. {
  281. columns.Add(column);
  282. }
  283. return this;
  284. }
  285. public IColumns Add(IColumn column)
  286. {
  287. if (column is Column<T> col)
  288. return Add(col);
  289. return this;
  290. }
  291. public IEnumerable<string> ColumnNames()
  292. {
  293. return Items.Select(c => c.Property);
  294. //List<String> result = new List<string>();
  295. //foreach (var col in Items)
  296. // result.Add(col.Property);
  297. //return result;
  298. }
  299. public Dictionary<String, Type> AsDictionary()
  300. {
  301. Dictionary< String, Type> result = new Dictionary< String, Type>();
  302. foreach (var column in Items)
  303. result[column.Property] = column.Type;
  304. return result;
  305. }
  306. public IColumns DefaultColumns(params ColumnType[] types)
  307. {
  308. return Default(types);
  309. }
  310. public Columns<T> Add(params string[] columnnames)
  311. {
  312. foreach (var name in columnnames)
  313. Add(name);
  314. return this;
  315. }
  316. public Columns<T> Add(IEnumerable<string> columnnames)
  317. {
  318. foreach (var name in columnnames)
  319. Add(name);
  320. return this;
  321. }
  322. public Columns<T> Add(Expression<Func<T, object?>> expression)
  323. {
  324. try
  325. {
  326. var property = CoreUtils.GetFullPropertyName(expression, ".");
  327. var exists = columns.Any(x => x.Expression.ToString().Replace("x.", "").Equals(property));
  328. if (!exists)
  329. columns.Add(new Column<T>(expression));
  330. }
  331. catch (Exception e)
  332. {
  333. Logger.Send(LogType.Error, "", string.Format("*** Unknown Error: {0}\n{1}", e.Message, e.StackTrace));
  334. }
  335. return this;
  336. }
  337. public Columns<T> Add<TType>(Expression<Func<T, TType>> expression)
  338. {
  339. try
  340. {
  341. var property = CoreUtils.GetFullPropertyName(expression, ".");
  342. var exists = columns.Any(x => x.Expression.ToString().Replace("x.", "").Equals(property));
  343. if (!exists)
  344. {
  345. columns.Add(new Column<T>(property));
  346. }
  347. }
  348. catch (Exception e)
  349. {
  350. Logger.Send(LogType.Error, "", string.Format("*** Unknown Error: {0}\n{1}", e.Message, e.StackTrace));
  351. }
  352. return this;
  353. }
  354. public Columns<T> Remove(string column)
  355. {
  356. var col = new Column<T>(column);
  357. columns.RemoveAll(x => x.ToString() == col.ToString());
  358. return this;
  359. }
  360. public static explicit operator Columns<T>(Columns<Entity> vs)
  361. {
  362. var result = new Columns<T>();
  363. var items = vs.Items.Cast<Column<T>>().ToArray();
  364. result.Items = items;
  365. //List<Column<T>> cols = new List<Column<T>>();
  366. //foreach (var v in vs.Items)
  367. // cols.Add((Column<T>)v);
  368. //result.Items = cols.ToArray();
  369. return result;
  370. }
  371. public Columns<T> Default(params ColumnType[] types)
  372. {
  373. columns.Clear();
  374. var props = DatabaseSchema.Properties(typeof(T)).Where(x=>x.Setter() != null).OrderBy(x => CoreUtils.GetPropertySequence(typeof(T), x.Name)).ToList();
  375. if (types.Contains(ColumnType.All))
  376. {
  377. foreach (var prop in props)
  378. columns.Add(new Column<T>(prop.Name));
  379. return this;
  380. }
  381. else if (types.Contains(ColumnType.DataColumns))
  382. {
  383. foreach(var prop in props)
  384. {
  385. if (prop.IsCalculated)
  386. {
  387. continue;
  388. }
  389. if (prop.HasParentEntityLink())
  390. {
  391. if(prop.Parent?.HasParentEntityLink() == true || !prop.Name.EndsWith(".ID"))
  392. {
  393. continue;
  394. }
  395. }
  396. columns.Add(new Column<T>(prop.Name));
  397. }
  398. if(types.Length == 1)
  399. {
  400. return this;
  401. }
  402. }
  403. if (typeof(T).IsSubclassOf(typeof(Entity)) && !types.Contains(ColumnType.ExcludeID))
  404. columns.Add(new Column<T>("ID"));
  405. for (int iCol = 0; iCol < props.Count; iCol++)
  406. {
  407. var prop = props[iCol];
  408. var bOK = true;
  409. var bIsForeignKey = false;
  410. var bNullEditor = prop.Editor is NullEditor;
  411. if (prop is CustomProperty)
  412. {
  413. if (!types.Any(x => x.Equals(ColumnType.IncludeUserProperties)))
  414. bOK = false;
  415. else
  416. columns.Add(new Column<T>(prop.Name));
  417. }
  418. if (bOK)
  419. if (prop.Name.Contains(".") && !(prop is CustomProperty))
  420. {
  421. var ancestors = prop.Name.Split('.');
  422. var anclevel = 2;
  423. for (var i = 1; i < ancestors.Length; i++)
  424. {
  425. var ancestor = string.Join(".", ancestors.Take(i));
  426. var ancprop = CoreUtils.GetProperty(typeof(T), ancestor);
  427. bNullEditor = bNullEditor || ancprop.GetCustomAttribute<NullEditor>() != null;
  428. if (ancprop.PropertyType.GetInterfaces().Contains(typeof(IEnclosedEntity)))
  429. anclevel++;
  430. else if (ancprop.PropertyType.GetInterfaces().Contains(typeof(IEntityLink)))
  431. {
  432. if (types.Contains(ColumnType.IncludeLinked) || types.Contains(ColumnType.IncludeForeignKeys))
  433. {
  434. if (types.Contains(ColumnType.IncludeNestedLinks) || ancestors.Length <= anclevel)
  435. {
  436. if (prop.Name.EndsWith(".ID") && types.Contains(ColumnType.IncludeForeignKeys))
  437. {
  438. bIsForeignKey = true;
  439. break;
  440. }
  441. if (!types.Contains(ColumnType.IncludeLinked))
  442. {
  443. bOK = false;
  444. break;
  445. }
  446. }
  447. else
  448. {
  449. bOK = false;
  450. break;
  451. }
  452. }
  453. else
  454. {
  455. bOK = false;
  456. break;
  457. }
  458. }
  459. }
  460. }
  461. if (bOK)
  462. {
  463. var visible = prop.Editor != null
  464. ? bNullEditor
  465. ? Visible.Hidden
  466. : prop.Editor.Visible
  467. : Visible.Optional;
  468. var editable = prop.Editor != null
  469. ? bNullEditor
  470. ? Editable.Hidden
  471. : prop.Editor.Editable
  472. : Editable.Enabled;
  473. bOK = (types.Any(x => x.Equals(ColumnType.IncludeForeignKeys)) && bIsForeignKey) ||
  474. (!types.Any(x => x.Equals(ColumnType.ExcludeVisible)) && visible.Equals(Visible.Default)) ||
  475. (types.Any(x => x.Equals(ColumnType.IncludeOptional)) && visible.Equals(Visible.Optional)) ||
  476. (types.Any(x => x.Equals(ColumnType.IncludeEditable)) && editable.ColumnVisible());
  477. }
  478. var property = bOK ? DatabaseSchema.Property(typeof(T), prop.Name) : null;
  479. if (property is StandardProperty)
  480. {
  481. if (bOK && !types.Any(x => x.Equals(ColumnType.IncludeAggregates)))
  482. bOK = CoreUtils.GetProperty(typeof(T), prop.Name).GetCustomAttribute<AggregateAttribute>() == null;
  483. if (bOK && !types.Any(x => x.Equals(ColumnType.IncludeFormulae)))
  484. bOK = CoreUtils.GetProperty(typeof(T), prop.Name).GetCustomAttribute<FormulaAttribute>() == null;
  485. }
  486. if (bOK && !columns.Any(x => string.Equals(x.Property?.ToUpper(), prop.Name?.ToUpper())))
  487. {
  488. if (prop.Editor is LookupEditor le)
  489. {
  490. if (le.OtherColumns != null)
  491. {
  492. var prefix = String.Join(".",prop.Name.Split('.').Reverse().Skip(1).Reverse());
  493. foreach (var col in le.OtherColumns)
  494. {
  495. String newcol = prefix + "." + col.Key;
  496. if (!columns.Any(x => String.Equals(newcol, x.Property)))
  497. columns.Add(new Column<T>(newcol));
  498. }
  499. }
  500. }
  501. if (!columns.Any(x => String.Equals(prop.Name, x.Property)))
  502. columns.Add(new Column<T>(prop.Name));
  503. }
  504. }
  505. return this;
  506. }
  507. #region Binary Serialization
  508. public void SerializeBinary(CoreBinaryWriter writer)
  509. {
  510. writer.Write(columns.Count);
  511. foreach(var column in columns)
  512. {
  513. writer.Write(column.Property);
  514. }
  515. }
  516. public void DeserializeBinary(CoreBinaryReader reader)
  517. {
  518. columns.Clear();
  519. var nColumns = reader.ReadInt32();
  520. for(int i = 0; i < nColumns; ++i)
  521. {
  522. var property = reader.ReadString();
  523. columns.Add(new Column<T>(property));
  524. }
  525. }
  526. #endregion
  527. public IEnumerator<Column<T>> GetEnumerator()
  528. {
  529. return columns.GetEnumerator();
  530. }
  531. IEnumerator IEnumerable.GetEnumerator()
  532. {
  533. return columns.GetEnumerator();
  534. }
  535. }
  536. public static class ColumnsExtensions
  537. {
  538. public static Columns<T> ToColumns<T>(this IEnumerable<Column<T>> columns)
  539. {
  540. return new Columns<T>(columns.ToList());
  541. }
  542. }
  543. public static class ColumnSerialization
  544. {
  545. /// <summary>
  546. /// Inverse of <see cref="Write{T}(CoreBinaryWriter, Columns{T}?)"/>.
  547. /// </summary>
  548. /// <param name="reader"></param>
  549. /// <returns></returns>
  550. public static Columns<T>? ReadColumns<T>(this CoreBinaryReader reader)
  551. {
  552. if (reader.ReadBoolean())
  553. {
  554. var columns = new Columns<T>();
  555. columns.DeserializeBinary(reader);
  556. return columns;
  557. }
  558. return null;
  559. }
  560. /// <summary>
  561. /// Inverse of <see cref="ReadColumns{T}(CoreBinaryReader)"/>.
  562. /// </summary>
  563. /// <param name="filter"></param>
  564. /// <param name="writer"></param>
  565. public static void Write<T>(this CoreBinaryWriter writer, Columns<T>? columns)
  566. {
  567. if (columns is null)
  568. {
  569. writer.Write(false);
  570. }
  571. else
  572. {
  573. writer.Write(true);
  574. columns.SerializeBinary(writer);
  575. }
  576. }
  577. }
  578. public class ColumnJsonConverter : JsonConverter
  579. {
  580. public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
  581. {
  582. if(value is null)
  583. {
  584. writer.WriteNull();
  585. return;
  586. }
  587. var property = (CoreUtils.GetPropertyValue(value, "Expression") as Expression)
  588. ?? throw new Exception("'Column.Expression' may not be null");
  589. var prop = CoreUtils.ExpressionToString(value.GetType().GenericTypeArguments[0], property, true);
  590. var name = CoreUtils.GetPropertyValue(value, "Property") as string;
  591. writer.WriteStartObject();
  592. writer.WritePropertyName("$type");
  593. writer.WriteValue(value.GetType().FullName);
  594. writer.WritePropertyName("Expression");
  595. writer.WriteValue(prop);
  596. writer.WritePropertyName("Property");
  597. writer.WriteValue(name);
  598. writer.WriteEndObject();
  599. }
  600. public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
  601. {
  602. if (reader.TokenType == JsonToken.Null)
  603. return null;
  604. var data = new Dictionary<string, object>();
  605. while (reader.TokenType != JsonToken.EndObject && reader.Read())
  606. if (reader.Value != null)
  607. {
  608. var key = reader.Value.ToString();
  609. reader.Read();
  610. if (String.Equals(key, "$type"))
  611. objectType = Type.GetType(reader.Value.ToString()) ?? objectType;
  612. else
  613. data[key] = reader.Value;
  614. }
  615. var prop = data["Property"].ToString();
  616. var result = Activator.CreateInstance(objectType, prop);
  617. return result;
  618. }
  619. public override bool CanConvert(Type objectType)
  620. {
  621. if (objectType.IsConstructedGenericType)
  622. {
  623. var ot = objectType.GetGenericTypeDefinition();
  624. var tt = typeof(Column<>);
  625. if (ot == tt)
  626. return true;
  627. }
  628. return false;
  629. }
  630. }
  631. }