本文整理汇总了C#中Rock.Data.RockContext.Entry方法的典型用法代码示例。如果您正苦于以下问题:C# RockContext.Entry方法的具体用法?C# RockContext.Entry怎么用?C# RockContext.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Data.RockContext
的用法示例。
在下文中一共展示了RockContext.Entry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveCommunication
/// <summary>
/// Saves the communication.
/// </summary>
/// <param name="newNumberList">The new number list.</param>
/// <param name="updatedPersonList">The updated person list.</param>
private static void SaveCommunication( List<PhoneNumber> newNumberList, Dictionary<int, Person> updatedPersonList )
{
var rockContext = new RockContext();
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
if ( newNumberList.Any() )
{
rockContext.PhoneNumbers.AddRange( newNumberList );
}
if ( updatedPersonList.Any() )
{
foreach ( var person in updatedPersonList.Values.Where( p => p.Attributes.Any() ) )
{
// save current values before loading from the db
var newAttributes = person.Attributes;
var newValues = person.AttributeValues;
person.LoadAttributes( rockContext );
foreach ( var attributeCache in newAttributes.Select( a => a.Value ) )
{
var currentAttributeValue = person.AttributeValues[attributeCache.Key];
var newAttributeValue = newValues[attributeCache.Key].Value;
if ( currentAttributeValue.Value != newAttributeValue && !string.IsNullOrWhiteSpace( newAttributeValue ) )
{
// set the new value and send it to the database
currentAttributeValue.Value = newAttributeValue;
if ( currentAttributeValue.Id == 0 )
{
currentAttributeValue.EntityId = person.Id;
rockContext.Entry( currentAttributeValue ).State = EntityState.Added;
}
else
{
rockContext.Entry( currentAttributeValue ).State = EntityState.Modified;
}
}
}
}
}
rockContext.ChangeTracker.DetectChanges();
rockContext.SaveChanges( DisableAudit );
} );
}
示例2: SaveFiles
/// <summary>
/// Saves the files.
/// </summary>
/// <param name="newFileList">The new file list.</param>
private static void SaveFiles( List<DocumentKeys> newFileList, ProviderComponent storageProvider )
{
if ( storageProvider == null )
{
LogException( "Binary File Import", string.Format( "Could not load provider {0}.", storageProvider.ToString() ) );
return;
}
if ( newFileList.Any( f => f.File == null ) )
{
LogException( "Binary File Import", string.Format( "Could not load {0} files because they were null.", newFileList.Count( f => f.File == null ) ) );
}
var rockContext = new RockContext();
rockContext.WrapTransaction( () =>
{
foreach ( var entry in newFileList )
{
storageProvider.SaveContent( entry.File );
entry.File.Path = storageProvider.GetPath( entry.File );
}
var list = newFileList.Select( f => f.File ).ToList();
rockContext.BinaryFiles.AddRange( newFileList.Select( f => f.File ) );
rockContext.SaveChanges();
var currentPersonAttributes = new Dictionary<int, List<int>>();
foreach ( var entry in newFileList.OrderByDescending( f => f.File.CreatedDateTime ) )
{
List<int> attributeList = null;
if ( currentPersonAttributes.ContainsKey( entry.PersonId ) && currentPersonAttributes[entry.PersonId] != null )
{
attributeList = currentPersonAttributes[entry.PersonId];
}
else
{
// first document for this person in the current zip file, start a list
attributeList = new List<int>();
currentPersonAttributes.Add( entry.PersonId, attributeList );
}
if ( !attributeList.Contains( entry.AttributeId ) )
{
var attributeValue = rockContext.AttributeValues.FirstOrDefault( p => p.AttributeId == entry.AttributeId && p.EntityId == entry.PersonId );
// set person attribute value to this binary file guid
if ( attributeValue == null )
{
attributeValue = new AttributeValue();
attributeValue.IsSystem = false;
attributeValue.EntityId = entry.PersonId;
attributeValue.AttributeId = entry.AttributeId;
attributeValue.Value = entry.File.Guid.ToString();
rockContext.AttributeValues.Add( attributeValue );
}
else if ( attributeValue.CreatedDateTime < entry.File.CreatedDateTime )
{
attributeValue.Value = entry.File.Guid.ToString();
rockContext.Entry( attributeValue ).State = EntityState.Modified;
}
attributeList.Add( entry.AttributeId );
}
}
rockContext.SaveChanges( DisableAuditing );
} );
}
示例3: SaveCommunication
/// <summary>
/// Saves the communication.
/// </summary>
/// <param name="newNumberList">The new number list.</param>
/// <param name="updatedPersonList">The updated person list.</param>
private static void SaveCommunication( List<PhoneNumber> newNumberList, Dictionary<int, Person> updatedPersonList )
{
var rockContext = new RockContext();
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
if ( newNumberList.Any() )
{
rockContext.PhoneNumbers.AddRange( newNumberList );
}
if ( updatedPersonList.Any() )
{
foreach ( var person in updatedPersonList.Values.Where( p => p.Attributes.Any() ) )
{
// don't call LoadAttributes, it only rewrites existing cache objects
// person.LoadAttributes( rockContext );
foreach ( var attributeCache in person.Attributes.Select( a => a.Value ) )
{
var existingValue = rockContext.AttributeValues.FirstOrDefault( v => v.Attribute.Key == attributeCache.Key && v.EntityId == person.Id );
var newAttributeValue = person.AttributeValues[attributeCache.Key];
// set the new value and add it to the database
if ( existingValue == null )
{
existingValue = new AttributeValue();
existingValue.AttributeId = newAttributeValue.AttributeId;
existingValue.EntityId = person.Id;
existingValue.Value = newAttributeValue.Value;
rockContext.AttributeValues.Add( existingValue );
}
else
{
existingValue.Value = newAttributeValue.Value;
rockContext.Entry( existingValue ).State = EntityState.Modified;
}
}
}
}
rockContext.ChangeTracker.DetectChanges();
rockContext.SaveChanges( DisableAuditing );
} );
}
示例4: LoadIndividuals
//.........这里部分代码省略.........
newNote.Caption = string.Format( "{0} Note", notePair.Key );
if ( !notePair.Key.Equals( "General" ) )
{
newNote.IsAlert = true;
}
newNoteList.Add( newNote );
}
#endregion person create
var groupMember = new GroupMember();
groupMember.Person = person;
groupMember.GroupRoleId = groupRoleId;
groupMember.CreatedDateTime = ImportDateTime;
groupMember.ModifiedDateTime = ImportDateTime;
groupMember.CreatedByPersonAliasId = ImportPersonAliasId;
groupMember.GroupMemberStatus = GroupMemberStatus.Active;
if ( rowFamilyKey != currentFamilyGroup.ForeignKey )
{
// person not part of the previous family, see if that family exists or create a new one
currentFamilyGroup = ImportedFamilies.FirstOrDefault( g => g.ForeignKey == rowFamilyKey );
if ( currentFamilyGroup == null )
{
currentFamilyGroup = CreateFamilyGroup( row[FamilyName], rowFamilyKey );
newFamilyList.Add( currentFamilyGroup );
newFamilies++;
}
else
{
lookupContext.Groups.Attach( currentFamilyGroup );
lookupContext.Entry( currentFamilyGroup ).State = EntityState.Modified;
}
currentFamilyGroup.Members.Add( groupMember );
}
else
{
// person is part of this family group, check if they're a visitor
if ( isFamilyRelationship || currentFamilyGroup.Members.Count() < 1 )
{
currentFamilyGroup.Members.Add( groupMember );
}
else
{
var visitorFamily = CreateFamilyGroup( person.LastName + " Family", rowFamilyKey );
visitorFamily.Members.Add( groupMember );
newFamilyList.Add( visitorFamily );
newVisitorList.Add( visitorFamily );
newFamilies++;
}
}
// look ahead 1 row
string rowNextFamilyKey = "-1";
if ( (row = csvData.Database.FirstOrDefault()) != null )
{
rowNextFamilyKey = row[FamilyId];
}
newPeople++;
completed++;
if ( completed % (ReportingNumber * 10) < 1 )
{
示例5: SaveIndividuals
/// <summary>
/// Saves the individuals.
/// </summary>
/// <param name="newFamilyList">The family list.</param>
/// <param name="visitorList">The optional visitor list.</param>
private void SaveIndividuals( List<Group> newFamilyList, List<Group> visitorList = null, List<Note> newNoteList = null )
{
if ( newFamilyList.Any() )
{
var rockContext = new RockContext();
rockContext.WrapTransaction( ( ) =>
{
rockContext.Groups.AddRange( newFamilyList );
rockContext.SaveChanges( DisableAuditing );
ImportedFamilies.AddRange( newFamilyList );
foreach ( var familyGroups in newFamilyList.GroupBy<Group, string>( g => g.ForeignKey ) )
{
bool visitorsExist = visitorList.Any() && familyGroups.Any();
foreach ( var newFamilyGroup in familyGroups )
{
foreach ( var person in newFamilyGroup.Members.Select( m => m.Person ) )
{
// Set notes on this person
if ( newNoteList.Any( n => n.ForeignKey == person.ForeignKey ) )
{
newNoteList.Where( n => n.ForeignKey == person.ForeignKey ).ToList()
.ForEach( n => n.EntityId = person.Id );
}
// Set attributes on this person
foreach ( var attributeCache in person.Attributes.Select( a => a.Value ) )
{
var existingValue = rockContext.AttributeValues.FirstOrDefault( v => v.Attribute.Key == attributeCache.Key && v.EntityId == person.Id );
var newAttributeValue = person.AttributeValues[attributeCache.Key];
// set the new value and add it to the database
if ( existingValue == null )
{
existingValue = new AttributeValue();
existingValue.AttributeId = newAttributeValue.AttributeId;
existingValue.EntityId = person.Id;
existingValue.Value = newAttributeValue.Value;
rockContext.AttributeValues.Add( existingValue );
}
else
{
existingValue.Value = newAttributeValue.Value;
rockContext.Entry( existingValue ).State = EntityState.Modified;
}
}
// Set aliases on this person
if ( !person.Aliases.Any( a => a.PersonId == person.Id ) )
{
person.Aliases.Add( new PersonAlias
{
AliasPersonId = person.Id,
AliasPersonGuid = person.Guid,
ForeignKey = person.ForeignKey,
ForeignId = person.ForeignId,
PersonId = person.Id
} );
}
person.GivingGroupId = newFamilyGroup.Id;
if ( visitorsExist )
{
var groupTypeRoleService = new GroupTypeRoleService( rockContext );
var ownerRole = groupTypeRoleService.Get( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_OWNER ) );
int inviteeRoleId = groupTypeRoleService.Get( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_INVITED ) ).Id;
int invitedByRoleId = groupTypeRoleService.Get( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_INVITED_BY ) ).Id;
int canCheckInRoleId = groupTypeRoleService.Get( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_CAN_CHECK_IN ) ).Id;
int allowCheckInByRoleId = groupTypeRoleService.Get( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_ALLOW_CHECK_IN_BY ) ).Id;
// Retrieve or create the group this person is an owner of
var ownerGroup = new GroupMemberService( rockContext ).Queryable()
.Where( m => m.PersonId == person.Id && m.GroupRoleId == ownerRole.Id )
.Select( m => m.Group ).FirstOrDefault();
if ( ownerGroup == null )
{
var ownerGroupMember = new GroupMember();
ownerGroupMember.PersonId = person.Id;
ownerGroupMember.GroupRoleId = ownerRole.Id;
ownerGroup = new Group();
ownerGroup.Name = ownerRole.GroupType.Name;
ownerGroup.GroupTypeId = ownerRole.GroupTypeId.Value;
ownerGroup.Members.Add( ownerGroupMember );
rockContext.Groups.Add( ownerGroup );
}
// Visitor, add relationships to the family members
if ( visitorList.Where( v => v.ForeignKey == newFamilyGroup.ForeignKey )
.Any( v => v.Members.Any( m => m.Person.ForeignKey.Equals( person.ForeignKey ) ) ) )
{
var familyMembers = familyGroups.Except( visitorList ).SelectMany( g => g.Members );
//.........这里部分代码省略.........
示例6: SavePeople
/// <summary>
/// Saves the people.
/// </summary>
/// <param name="familyList">The family list.</param>
/// <param name="visitorList">The visitor list.</param>
/// <param name="ownerRole">The owner role.</param>
/// <param name="childRoleId">The child role identifier.</param>
/// <param name="inviteeRoleId">The invitee role identifier.</param>
/// <param name="invitedByRoleId">The invited by role identifier.</param>
/// <param name="canCheckInRoleId">The can check in role identifier.</param>
/// <param name="allowCheckInByRoleId">The allow check in by role identifier.</param>
private void SavePeople( List<Group> familyList, List<Group> visitorList, Dictionary<Guid, string> previousNamesList, GroupTypeRole ownerRole, int childRoleId, int inviteeRoleId, int invitedByRoleId, int canCheckInRoleId, int allowCheckInByRoleId )
{
var rockContext = new RockContext();
var groupMemberService = new GroupMemberService( rockContext );
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
rockContext.Groups.AddRange( familyList );
rockContext.SaveChanges( DisableAuditing );
foreach ( var familyGroups in familyList.GroupBy<Group, int?>( g => g.ForeignId ) )
{
bool visitorsExist = familyGroups.Count() > 1;
foreach ( var newFamilyGroup in familyGroups )
{
foreach ( var groupMember in newFamilyGroup.Members )
{
// don't call LoadAttributes, it only rewrites existing cache objects
// groupMember.Person.LoadAttributes( rockContext );
foreach ( var attributeCache in groupMember.Person.Attributes.Select( a => a.Value ) )
{
var existingValue = rockContext.AttributeValues.FirstOrDefault( v => v.Attribute.Key == attributeCache.Key && v.EntityId == groupMember.Person.Id );
var newAttributeValue = groupMember.Person.AttributeValues[attributeCache.Key];
// set the new value and add it to the database
if ( existingValue == null )
{
existingValue = new AttributeValue();
existingValue.AttributeId = newAttributeValue.AttributeId;
existingValue.EntityId = groupMember.Person.Id;
existingValue.Value = newAttributeValue.Value;
rockContext.AttributeValues.Add( existingValue );
}
else
{
existingValue.Value = newAttributeValue.Value;
rockContext.Entry( existingValue ).State = EntityState.Modified;
}
}
// add a default person alias
if ( !groupMember.Person.Aliases.Any( a => a.AliasPersonId == groupMember.Person.Id ) )
{
groupMember.Person.Aliases.Add( new PersonAlias
{
AliasPersonId = groupMember.Person.Id,
AliasPersonGuid = groupMember.Person.Guid,
ForeignId = groupMember.Person.ForeignId,
ForeignKey = groupMember.Person.ForeignKey
} );
}
// assign the previous name
if ( previousNamesList.Any( l => l.Key.Equals( groupMember.Person.Guid ) ) )
{
var newPreviousName = new PersonPreviousName();
newPreviousName.LastName = previousNamesList[groupMember.Person.Guid];
newPreviousName.PersonAlias = groupMember.Person.Aliases.FirstOrDefault();
rockContext.PersonPreviousNames.Add( newPreviousName );
}
// assign the giving group
if ( groupMember.GroupRoleId != childRoleId )
{
groupMember.Person.GivingGroupId = newFamilyGroup.Id;
}
if ( visitorsExist )
{
// Retrieve or create the group this person is an owner of
var ownerGroup = groupMemberService.Queryable()
.Where( m => m.PersonId == groupMember.Person.Id && m.GroupRoleId == ownerRole.Id )
.Select( m => m.Group )
.FirstOrDefault();
if ( ownerGroup == null )
{
var ownerGroupMember = new GroupMember();
ownerGroupMember.PersonId = groupMember.Person.Id;
ownerGroupMember.GroupRoleId = ownerRole.Id;
ownerGroup = new Group();
ownerGroup.Name = ownerRole.GroupType.Name;
ownerGroup.GroupTypeId = ownerRole.GroupTypeId.Value;
ownerGroup.Members.Add( ownerGroupMember );
rockContext.Groups.Add( ownerGroup );
}
//.........这里部分代码省略.........
示例7: SaveCompanies
/// <summary>
/// Saves the companies.
/// </summary>
/// <param name="businessList">The business list.</param>
private void SaveCompanies( List<Group> businessList )
{
var rockContext = new RockContext();
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
rockContext.Groups.AddRange( businessList );
rockContext.SaveChanges( DisableAuditing );
foreach ( var newBusiness in businessList )
{
foreach ( var groupMember in newBusiness.Members )
{
// don't call LoadAttributes, it only rewrites existing cache objects
// groupMember.Person.LoadAttributes( rockContext );
foreach ( var attributeCache in groupMember.Person.Attributes.Select( a => a.Value ) )
{
var existingValue = rockContext.AttributeValues.FirstOrDefault( v => v.Attribute.Key == attributeCache.Key && v.EntityId == groupMember.Person.Id );
var newAttributeValue = groupMember.Person.AttributeValues[attributeCache.Key];
// set the new value and add it to the database
if ( existingValue == null )
{
existingValue = new AttributeValue();
existingValue.AttributeId = newAttributeValue.AttributeId;
existingValue.EntityId = groupMember.Person.Id;
existingValue.Value = newAttributeValue.Value;
rockContext.AttributeValues.Add( existingValue );
}
else
{
existingValue.Value = newAttributeValue.Value;
rockContext.Entry( existingValue ).State = EntityState.Modified;
}
}
if ( !groupMember.Person.Aliases.Any( a => a.AliasPersonId == groupMember.Person.Id ) )
{
groupMember.Person.Aliases.Add( new PersonAlias { AliasPersonId = groupMember.Person.Id, AliasPersonGuid = groupMember.Person.Guid } );
}
groupMember.Person.GivingGroupId = newBusiness.Id;
}
}
rockContext.ChangeTracker.DetectChanges();
rockContext.SaveChanges( DisableAuditing );
if ( businessList.Any() )
{
var groupMembers = businessList.SelectMany( gm => gm.Members );
ImportedPeople.AddRange( groupMembers.Select( m => new PersonKeys
{
PersonAliasId = (int)m.Person.PrimaryAliasId,
PersonId = m.Person.Id,
IndividualId = null,
HouseholdId = m.Group.ForeignId,
FamilyRoleId = FamilyRole.Adult
} ).ToList()
);
}
} );
}
示例8: SavePeople
/// <summary>
/// Saves the people.
/// </summary>
/// <param name="familyList">The family list.</param>
/// <param name="visitorList">The visitor list.</param>
/// <param name="ownerRole">The owner role.</param>
/// <param name="childRoleId">The child role identifier.</param>
/// <param name="inviteeRoleId">The invitee role identifier.</param>
/// <param name="invitedByRoleId">The invited by role identifier.</param>
/// <param name="canCheckInRoleId">The can check in role identifier.</param>
/// <param name="allowCheckInByRoleId">The allow check in by role identifier.</param>
private void SavePeople( List<Group> familyList, List<Group> visitorList, GroupTypeRole ownerRole, int childRoleId, int inviteeRoleId, int invitedByRoleId, int canCheckInRoleId, int allowCheckInByRoleId )
{
var rockContext = new RockContext();
var groupMemberService = new GroupMemberService( rockContext );
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
rockContext.Groups.AddRange( familyList );
rockContext.SaveChanges( DisableAudit );
foreach ( var familyGroups in familyList.GroupBy<Group, int?>( g => g.ForeignId.AsType<int?>() ) )
{
bool visitorsExist = familyGroups.Count() > 1;
foreach ( var newFamilyGroup in familyGroups )
{
foreach ( var groupMember in newFamilyGroup.Members )
{
var person = groupMember.Person;
// save current values before loading from the db
var newPersonAttributes = person.Attributes;
var newPersonValues = person.AttributeValues;
person.LoadAttributes( rockContext );
foreach ( var attributeCache in newPersonAttributes.Select( a => a.Value ) )
{
var currentAttributeValue = person.AttributeValues[attributeCache.Key];
var newAttributeValue = newPersonValues[attributeCache.Key].Value;
if ( currentAttributeValue.Value != newAttributeValue && !string.IsNullOrWhiteSpace( newAttributeValue ) )
{
// set the new value and add it to the database
currentAttributeValue.Value = newAttributeValue;
if ( currentAttributeValue.Id == 0 )
{
currentAttributeValue.EntityId = person.Id;
rockContext.Entry( currentAttributeValue ).State = EntityState.Added;
}
else
{
rockContext.Entry( currentAttributeValue ).State = EntityState.Modified;
}
}
}
if ( !person.Aliases.Any( a => a.AliasPersonId == person.Id ) )
{
person.Aliases.Add( new PersonAlias { AliasPersonId = person.Id, AliasPersonGuid = person.Guid, ForeignId = person.ForeignId } );
}
if ( groupMember.GroupRoleId != childRoleId )
{
person.GivingGroupId = newFamilyGroup.Id;
}
if ( visitorsExist )
{
// Retrieve or create the group this person is an owner of
var ownerGroup = groupMemberService.Queryable()
.Where( m => m.PersonId == person.Id && m.GroupRoleId == ownerRole.Id )
.Select( m => m.Group )
.FirstOrDefault();
if ( ownerGroup == null )
{
var ownerGroupMember = new GroupMember();
ownerGroupMember.PersonId = person.Id;
ownerGroupMember.GroupRoleId = ownerRole.Id;
ownerGroup = new Group();
ownerGroup.Name = ownerRole.GroupType.Name;
ownerGroup.GroupTypeId = ownerRole.GroupTypeId.Value;
ownerGroup.Members.Add( ownerGroupMember );
rockContext.Groups.Add( ownerGroup );
}
// if this is a visitor, then add relationships to the family member(s)
if ( visitorList.Where( v => v.ForeignId == newFamilyGroup.ForeignId )
.Any( v => v.Members.Any( m => m.Person.ForeignId.Equals( person.ForeignId ) ) ) )
{
var familyMembers = familyGroups.Except( visitorList ).SelectMany( g => g.Members );
foreach ( var familyMember in familyMembers.Select( m => m.Person ) )
{
var invitedByMember = new GroupMember();
invitedByMember.PersonId = familyMember.Id;
invitedByMember.GroupRoleId = invitedByRoleId;
ownerGroup.Members.Add( invitedByMember );
if ( person.Age < 18 && familyMember.Age > 18 )
{
//.........这里部分代码省略.........
示例9: SaveCompanies
/// <summary>
/// Saves the companies.
/// </summary>
/// <param name="businessList">The business list.</param>
private void SaveCompanies( List<Group> businessList )
{
var rockContext = new RockContext();
rockContext.WrapTransaction( () =>
{
rockContext.Configuration.AutoDetectChangesEnabled = false;
rockContext.Groups.AddRange( businessList );
rockContext.SaveChanges( DisableAudit );
foreach ( var newBusiness in businessList )
{
foreach ( var groupMember in newBusiness.Members )
{
foreach ( var attributeCache in groupMember.Person.Attributes.Select( a => a.Value ) )
{
var newValue = groupMember.Person.AttributeValues[attributeCache.Key];
if ( newValue != null )
{
newValue.EntityId = groupMember.Person.Id;
rockContext.Entry( newValue ).State = EntityState.Added;
}
}
var person = groupMember.Person;
if ( !person.Aliases.Any( a => a.AliasPersonId == person.Id ) )
{
person.Aliases.Add( new PersonAlias { AliasPersonId = person.Id, AliasPersonGuid = person.Guid } );
}
person.GivingGroupId = newBusiness.Id;
}
}
rockContext.ChangeTracker.DetectChanges();
rockContext.SaveChanges( DisableAudit );
if ( businessList.Any() )
{
var groupMembers = businessList.SelectMany( gm => gm.Members );
ImportedPeople.AddRange( groupMembers.Select( m => new PersonKeys
{
PersonAliasId = (int)m.Person.PrimaryAliasId,
PersonId = m.Person.Id,
IndividualId = null,
HouseholdId = m.Group.ForeignId.AsType<int?>(),
IsFamilyMember = true
} ).ToList()
);
}
} );
}