src/Misc/EFTools/EntityDesign/UI/ViewModels/PropertyWindow/PropertyWindowViewModel.cs
// <summary>
//     Returns a wrapper for the specified EFObject. The wrapper is the type descriptor
//     that describes the properties that should be displayed for the EFObject.
//     The returned wrapper should be handed to a property window control
// </summary>
Returns a wrapper for the specified EFObject. The wrapper is the type descriptor
that describes the properties that should be displayed for the EFObject.
The returned wrapper should be handed to a property window control
Returns a wrapper for the specified EFObject . The wrapper is the type descriptor that describes the properties that should be displayed for the EFObject . The returned wrapper should be handed to a property window control
public static ObjectDescriptor GetObjectDescriptor(EFObject obj, EditingContext editingContext, bool runningInVS)
        {
            if (obj != null)
            {
                Type objectDescriptorType;
                if (ObjectDescriptorTypes.TryGetValue(obj.GetType(), out objectDescriptorType))
                {
                    var descriptor = (ObjectDescriptor)TypeDescriptor.CreateInstance(null, objectDescriptorType, null, null);
                    descriptor.Initialize(obj, editingContext, runningInVS);
                    return descriptor;
                }
                else
                {
                    var property = obj as Property;
                    if (property != null)
                    {
                        ObjectDescriptor descriptor = null;
                        if (property is ComplexConceptualProperty)
                        {
                            descriptor =
                                (ObjectDescriptor)TypeDescriptor.CreateInstance(null, typeof(EFComplexPropertyDescriptor), null, null);
                        }
                        else if (property.EntityModel.IsCSDL)
                        {
                            descriptor = (ObjectDescriptor)TypeDescriptor.CreateInstance(null, typeof(EFPropertyDescriptor), null, null);
                        }
                        else
                        {
                            descriptor = (ObjectDescriptor)TypeDescriptor.CreateInstance(null, typeof(EFSPropertyDescriptor), null, null);
                        }
                        descriptor.Initialize(obj, editingContext, runningInVS);
                        return descriptor;
                    }
                    var parameter = obj as Parameter;
                    if (parameter != null)
                    {
                        ObjectDescriptor descriptor = null;
                        if (parameter.Parent is FunctionImport)
                        {
                            descriptor = (ObjectDescriptor)TypeDescriptor.CreateInstance(null, typeof(EFParameterDescriptor), null, null);
                            descriptor.Initialize(obj, editingContext, runningInVS);
                            return descriptor;
                        }
                        else if (parameter.Parent is Function)
                        {
                            descriptor = (ObjectDescriptor)TypeDescriptor.CreateInstance(null, typeof(EFSParameterDescriptor), null, null);
                            descriptor.Initialize(obj, editingContext, runningInVS);
                            return descriptor;
                        }
                    }
                }
            }
            return null;
        }
public static ObjectDescriptor GetObjectDescriptor ( EFObject obj , EditingContext editingContext , bool runningInVS ) { if ( obj != null ) { Type objectDescriptorType ; if ( ObjectDescriptorTypes . TryGetValue ( obj . GetType ( ) , out objectDescriptorType ) ) { var descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , objectDescriptorType , null , null ) ; descriptor . Initialize ( obj , editingContext , runningInVS ) ; return descriptor ; } else { var property = obj as Property ; if ( property != null ) { ObjectDescriptor descriptor = null ; if ( property is ComplexConceptualProperty ) { descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , typeof ( EFComplexPropertyDescriptor ) , null , null ) ; } else if ( property . EntityModel . IsCSDL ) { descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , typeof ( EFPropertyDescriptor ) , null , null ) ; } else { descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , typeof ( EFSPropertyDescriptor ) , null , null ) ; } descriptor . Initialize ( obj , editingContext , runningInVS ) ; return descriptor ; } var parameter = obj as Parameter ; if ( parameter != null ) { ObjectDescriptor descriptor = null ; if ( parameter . Parent is FunctionImport ) { descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , typeof ( EFParameterDescriptor ) , null , null ) ; descriptor . Initialize ( obj , editingContext , runningInVS ) ; return descriptor ; } else if ( parameter . Parent is Function ) { descriptor = ( ObjectDescriptor ) TypeDescriptor . CreateInstance ( null , typeof ( EFSParameterDescriptor ) , null , null ) ; descriptor . Initialize ( obj , editingContext , runningInVS ) ; return descriptor ; } } } } return null ; }
Returns a wrapper for the specified EFObject.
Returns a wrapper for the specified EFObject .
// create the descriptor wrapper for the EFObject object // special case for Property // special case for Parameter //Stored procedure parameter descriptor (EFSParameterDescriptor)
obj
EFObject
editingContext
EditingContext
runningInVS
bool