NHibernate ClassMap get column name for property

后端 未结 2 1099
日久生厌
日久生厌 2021-01-21 10:16

I have ClassMap and entity. In code I would like to get column names for properties in entity. Any Idea?

public class AccountToDepotMap : ClassMap

        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-21 10:42

    using above code

    This is working in my case

    List columns = new List();
            for (int i = 0; i < persister.PropertyNames.Count(); i++)
            {
                if (persister.GetPropertyColumnNames(i).Count() > 0)
                {
                    columns.Add(persister.GetPropertyColumnNames(i).ToList().First());
                }
            }
    

提交回复
热议问题