src/Inflatable/Aspect/EndMethod/SingleProperty.cs
/// <summary>
/// Setups the specified return value name.
/// </summary>
/// <param name="returnValueName">Name of the return value.</param>
/// <param name="method">The method.</param>
/// <param name="mapping">The mapping.</param>
/// <param name="builder">The builder.</param>
Setups the specified return value name.
Setups the specified return value name .
public void Setup(string returnValueName, MethodInfo method, IMapping mapping, StringBuilder builder)
        {
            if (mapping is null)
                return;
            var Property = mapping.MapProperties.Find(x => x.Name == method.Name.Replace("get_", string.Empty, StringComparison.Ordinal));
            if (Property is null)
            {
                return;
            }
            builder.AppendLineFormat("if(!{0}&&!(Session0 is null))", Property.InternalFieldName + "Loaded")
                .AppendLine("{")
                .AppendLineFormat("{0}=Session0.LoadProperty<{1},{2}>(this,\"{3}\");",
                        Property.InternalFieldName,
                        Property.ParentMapping.ObjectType.GetName(),
                        Property.TypeName,
                        Property.Name)
                .AppendLineFormat("{0}=true;", Property.InternalFieldName + "Loaded")
                .AppendLineFormat("if(!({0} is null))", Property.InternalFieldName)
                .AppendLine("{")
                .AppendLineFormat("({0} as INotifyPropertyChanged).PropertyChanged+=(x,y)=>NotifyPropertyChanged0(\"{1}\");", Property.InternalFieldName, Property.Name)
                .AppendLine("}")
                .AppendLine("}")
                .AppendLineFormat("{0}={1};",
                    returnValueName,
                    Property.InternalFieldName);
        }
public void Setup ( string returnValueName , MethodInfo method , IMapping mapping , StringBuilder builder ) { if ( mapping is null ) return ; var Property = mapping . MapProperties . Find ( x => x . Name == method . Name . Replace ( " " , string . Empty , StringComparison . Ordinal ) ) ; if ( Property is null ) { return ; } builder . AppendLineFormat ( " " , Property . InternalFieldName + " " ) . AppendLine ( " " ) . AppendLineFormat ( " \" \" " , Property . InternalFieldName , Property . ParentMapping . ObjectType . GetName ( ) , Property . TypeName , Property . Name ) . AppendLineFormat ( " " , Property . InternalFieldName + " " ) . AppendLineFormat ( " " , Property . InternalFieldName ) . AppendLine ( " " ) . AppendLineFormat ( " \" \" " , Property . InternalFieldName , Property . Name ) . AppendLine ( " " ) . AppendLine ( " " ) . AppendLineFormat ( " " , returnValueName , Property . InternalFieldName ) ; }
Setups the specified return value name.
Setups the specified return value name .
returnValueName
string
Name of the return value.
Name of the return value .
method
MethodInfo
None
mapping
IMapping
None
builder
StringBuilder
None