示例#1
0
            // <summary>
            // Make sure the other metadata instance generates the same property
            // (otherwise, we get incorrect behavior where multiple nav props return
            // the same type)
            // </summary>
            protected override bool IsStructurallyEquivalent(InitializerMetadata other)
            {
                // caller must ensure the type matches
                var otherInitializer = (EntityCollectionInitializerMetadata)other;

                return(_navigationProperty.Equals(otherInitializer._navigationProperty));
            }
示例#2
0
            protected override bool IsStructurallyEquivalent(InitializerMetadata other)
            {
                // caller must ensure the type matches
                var otherProjection = (ProjectionNewMetadata)other;

                if (_newExpression.Members == null &&
                    otherProjection._newExpression.Members == null)
                {
                    return(true);
                }

                if (_newExpression.Members == null ||
                    otherProjection._newExpression.Members == null)
                {
                    return(false);
                }

                if (_newExpression.Members.Count
                    != otherProjection._newExpression.Members.Count)
                {
                    return(false);
                }

                for (var i = 0; i < _newExpression.Members.Count; i++)
                {
                    var thisMember  = _newExpression.Members[i];
                    var otherMember = otherProjection._newExpression.Members[i];
                    if (!thisMember.Equals(otherMember))
                    {
                        return(false);
                    }
                }

                return(true);
            }
 protected override bool IsStructurallyEquivalent(InitializerMetadata other)
 {
     InitializerMetadata.ProjectionInitializerMetadata initializerMetadata = (InitializerMetadata.ProjectionInitializerMetadata)other;
     if (this._initExpression.Bindings.Count != initializerMetadata._initExpression.Bindings.Count)
     {
         return(false);
     }
     for (int index = 0; index < this._initExpression.Bindings.Count; ++index)
     {
         if (!this._initExpression.Bindings[index].Member.Equals((object)initializerMetadata._initExpression.Bindings[index].Member))
         {
             return(false);
         }
     }
     return(true);
 }
 protected override bool IsStructurallyEquivalent(InitializerMetadata other)
 {
     InitializerMetadata.ProjectionNewMetadata projectionNewMetadata = (InitializerMetadata.ProjectionNewMetadata)other;
     if (this._newExpression.Members == null && projectionNewMetadata._newExpression.Members == null)
     {
         return(true);
     }
     if (this._newExpression.Members == null || projectionNewMetadata._newExpression.Members == null || this._newExpression.Members.Count != projectionNewMetadata._newExpression.Members.Count)
     {
         return(false);
     }
     for (int index = 0; index < this._newExpression.Members.Count; ++index)
     {
         if (!this._newExpression.Members[index].Equals((object)projectionNewMetadata._newExpression.Members[index]))
         {
             return(false);
         }
     }
     return(true);
 }
示例#5
0
            protected override bool IsStructurallyEquivalent(InitializerMetadata other)
            {
                // caller must ensure the type matches
                var otherProjection = (ProjectionInitializerMetadata)other;

                if (_initExpression.Bindings.Count
                    != otherProjection._initExpression.Bindings.Count)
                {
                    return(false);
                }

                for (var i = 0; i < _initExpression.Bindings.Count; i++)
                {
                    var thisBinding  = _initExpression.Bindings[i];
                    var otherBinding = otherProjection._initExpression.Bindings[i];
                    if (!thisBinding.Member.Equals(otherBinding.Member))
                    {
                        return(false);
                    }
                }

                return(true);
            }
 protected override bool IsStructurallyEquivalent(InitializerMetadata other)
 {
     return(this._navigationProperty.Equals((object)((InitializerMetadata.EntityCollectionInitializerMetadata)other)._navigationProperty));
 }
 internal override Expression Emit(List <TranslatorResult> propertyTranslatorResults)
 {
     Expression.Constant((object)null, this.ClrType);
     return((Expression)Expression.New(this._newExpression.Constructor, (IEnumerable <Expression>)InitializerMetadata.GetPropertyReaders(propertyTranslatorResults)));
 }
 internal override Expression Emit(List <TranslatorResult> propertyTranslatorResults)
 {
     return((Expression)Expression.Convert((Expression)Expression.New(((IEnumerable <ConstructorInfo>) typeof(InitializerMetadata.Grouping <,>).MakeGenericType(this.ClrType.GetGenericArguments()[0], this.ClrType.GetGenericArguments()[1]).GetConstructors()).Single <ConstructorInfo>(), (IEnumerable <Expression>)InitializerMetadata.GetPropertyReaders(propertyTranslatorResults)), this.ClrType));
 }