示例#1
0
        private void ParseForeignKey(InvocationExpressionSyntax node)
        {
            if (node == null || this.ParsedEntity == null)
            {
                return;
            }

            var propertyName = this.ParseLambaExpression(node);

            if (string.IsNullOrEmpty(propertyName))
            {
                return;
            }

            // start new relationship
            this._currentRelationship = new ParsedRelationship();
            this._currentRelationship.ThisProperties.Add(propertyName);
        }
示例#2
0
        private void ParseHasOne(InvocationExpressionSyntax node)
        {
            if (node == null || this.ParsedEntity == null || this._currentRelationship == null)
            {
                return;
            }

            var propertyName = this.ParseLambaExpression(node);

            if (!string.IsNullOrEmpty(propertyName))
            {
                this._currentRelationship.ThisPropertyName = propertyName;
            }

            // add and reset current relationship
            if (this._currentRelationship.IsValid())
            {
                this.ParsedEntity.Relationships.Add(this._currentRelationship);
            }

            this._currentRelationship = null;
        }