/// <summary> /// Creates a record for an extent containing default values. Assumes the extent is either /// a relationship set or an entity set. /// </summary> /// <remarks> /// Each scalar value appearing in the record is a <see cref="DbConstantExpression" />. A placeholder is created by recursively /// building a record, so an entity record type will return a new record (<see cref="DbNewInstanceExpression" />) /// consisting of some recursively built record for each column in the type. /// </remarks> /// <param name="extent">Extent</param> /// <param name="parent">Command tree used to generate portions of the record</param> /// <returns>A default record for the </returns> internal static PropagatorResult CreatePlaceholder(EntitySetBase extent, UpdateTranslator parent) { EntityUtil.CheckArgumentNull(extent, "extent"); ExtentPlaceholderCreator creator = new ExtentPlaceholderCreator(parent); AssociationSet associationSet = extent as AssociationSet; if (null != associationSet) { return creator.CreateAssociationSetPlaceholder(associationSet); } EntitySet entitySet = extent as EntitySet; if (null != entitySet) { return creator.CreateEntitySetPlaceholder(entitySet); } throw EntityUtil.NotSupported(System.Data.Entity.Strings.Update_UnsupportedExtentType( extent.Name, extent.GetType().Name)); }
/// <summary> /// Creates a record for an extent containing default values. Assumes the extent is either /// a relationship set or an entity set. /// </summary> /// <remarks> /// Each scalar value appearing in the record is a <see cref="DbConstantExpression" />. A placeholder is created by recursively /// building a record, so an entity record type will return a new record (<see cref="DbNewInstanceExpression" />) /// consisting of some recursively built record for each column in the type. /// </remarks> /// <param name="extent">Extent</param> /// <returns>A default record for the </returns> internal static PropagatorResult CreatePlaceholder(EntitySetBase extent) { //Contract.Requires(extent != null); var creator = new ExtentPlaceholderCreator(); var associationSet = extent as AssociationSet; if (null != associationSet) { return creator.CreateAssociationSetPlaceholder(associationSet); } var entitySet = extent as EntitySet; if (null != entitySet) { return creator.CreateEntitySetPlaceholder(entitySet); } throw new NotSupportedException( Strings.Update_UnsupportedExtentType( extent.Name, extent.GetType().Name)); }