public CachedEntityExpression(Expression primaryKey, Type type, CachedTableConstructor constructor, FieldEmbedded embedded) { if (primaryKey == null) { throw new ArgumentNullException("primaryKey"); } if (primaryKey.Type.UnNullify() != typeof(PrimaryKey)) { throw new InvalidOperationException("primaryKey should be a PrimaryKey"); } if (!type.IsEmbeddedEntity()) { if (((Table)constructor.table).Type != type.CleanType()) { throw new InvalidOperationException("Wrong type"); } } else { if (embedded == null) { throw new ArgumentNullException("embedded"); } this.FieldEmbedded = embedded; } this.PrimaryKey = primaryKey; this.type = type; this.Constructor = constructor; }
public readonly FieldEmbedded FieldEmbedded; //used for updates public EmbeddedEntityExpression(Type type, Expression hasValue, IEnumerable <FieldBinding> bindings, FieldEmbedded fieldEmbedded) : base(DbExpressionType.EmbeddedInit, type) { if (bindings == null) { throw new ArgumentNullException("bindings"); } if (hasValue == null || hasValue.Type != typeof(bool)) { throw new ArgumentException("hasValue should be a boolean expression"); } HasValue = hasValue; Bindings = bindings.ToReadOnly(); FieldEmbedded = fieldEmbedded; }