Esempio n. 1
0
        /// <summary>
        /// Get the batch size of a entity persister.
        /// </summary>
        //6.0 TODO: Merge into IEntityPersister.
        public static int GetBatchSize(this IEntityPersister persister)
        {
            if (persister is AbstractEntityPersister acp)
            {
                return(acp.BatchSize);
            }

            NHibernateLogger
            .For(typeof(EntityPersisterExtensions))
            .Warn("Entity persister of {0} type is not supported, returning 1 as a batch size.", persister?.GetType());

            return(1);
        }
        private static List<string> GetMappedColumns(IEntityPersister persister, IEnumerable<string> columnNames)
        {
            var criteriaInfoProvider = new EntityCriteriaInfoProvider((IQueryable)persister);

            var propertySpaces = persister.PropertySpaces;
            var propertyTableNumbersInSelect = (int[])persister.GetType().GetProperty("PropertyTableNumbersInSelect", InstanceNonPublicBinding | BindingFlags.GetProperty).GetValue(persister, new object[0]);

            var result = columnNames.Select((x, index) =>
            {
                return String.IsNullOrWhiteSpace(x) ? String.Empty : GenerateAlias(criteriaInfoProvider.PropertyMapping.ToColumns(x)[0], propertySpaces, propertyTableNumbersInSelect[index]);
            }).ToList();

            return result;
        }