private static CriteriaPropertyCollection GetFakeCreateCriteria(CslaObjectInfo info, int createIndex) { var result = new CriteriaPropertyCollection(); var index = 0; foreach (var crit in info.CriteriaObjects) { if (crit.IsGetter && !crit.IsCreator) { index++; if (index == createIndex) { var criteriaPropertyCollection = CriteriaPropertyCollection.Clone(crit.Properties); foreach (var criteriaProperty in criteriaPropertyCollection) { criteriaProperty.UnitOfWorkFactoryParameter = "true, " + CslaTemplateHelperCS.GetDataTypeInitExpression(criteriaProperty, criteriaProperty.PropertyType); } result.AddRange(criteriaPropertyCollection); break; } } } return(result); }
private static CriteriaPropertyCollection GetFakeCreateCriteria(CslaObjectInfo info, int createIndex) { var isCSharp = GeneratorController.Current.CurrentUnit.GenerationParams.OutputLanguage == CodeLanguage.CSharp; var result = new CriteriaPropertyCollection(); var index = 0; foreach (var crit in info.CriteriaObjects) { if (crit.IsGetter && !crit.IsCreator) { index++; if (index == createIndex) { var criteriaPropertyCollection = CriteriaPropertyCollection.Clone(crit.Properties); foreach (var criteriaProperty in criteriaPropertyCollection) { if (isCSharp) { criteriaProperty.UnitOfWorkFactoryParameter = "true, " + CslaTemplateHelperCS.GetDataTypeInitExpression(criteriaProperty, criteriaProperty.PropertyType); } else { criteriaProperty.UnitOfWorkFactoryParameter = "true, " + CslaTemplateHelperVB.GetDataTypeInitExpression(criteriaProperty, criteriaProperty.PropertyType); } } result.AddRange(criteriaPropertyCollection); break; } } } return(result); }