public static SerializableViewModel AssignFromRoot(this SerializableViewModel dest, ClassFiledSelectorRootViewModel src)
        {
            if (src == null)
            {
                return(dest);
            }

            dest.ViewModelName         = src.OutputClassName;
            dest.ViewModelNameSpace    = src.DestinationNameSpace;
            dest.ViewModelProjectName  = src.DestinationProjectName;
            dest.ViewModelFolderChain  = src.DestinationFoldersChain;
            dest.RootNodeClassName     = src.RootNodeClassName;
            dest.RootNodeNameSapce     = src.RootNodeNameSapce;
            dest.RootNodeProjectName   = src.RootNodeProjectName;
            dest.GenerateJSonAttribute = src.GenerateJSonAttribute;

            foreach (ClassFiledSelectorViewModel srcProp in src.ForeigKeyParentProperties)
            {
                if (!srcProp.TypeIsNullable)
                {
                    if (
                        (!"System.String".Equals(srcProp.UnderlyingTypeName, System.StringComparison.OrdinalIgnoreCase))
                        ||
                        srcProp.HasRequiredAttribute
                        )
                    {
                        if (string.IsNullOrEmpty(dest.RequiredRootFields))
                        {
                            dest.RequiredRootFields = srcProp.OriginalPropertyName;
                        }
                        else
                        {
                            dest.RequiredRootFields = dest.RequiredRootFields + ";" + srcProp.OriginalPropertyName;
                        }
                    }
                }
                if (!srcProp.IsKeyField)
                {
                    continue;
                }
                if (dest.PrimKeys == null)
                {
                    dest.PrimKeys = new List <SerializableViewModelProperty>();
                }
                SerializableViewModelProperty destPrimKey = new SerializableViewModelProperty()
                {
                    OriginalPropertyName  = srcProp.OriginalPropertyName,
                    ViewModelFieldName    = srcProp.ViewModelFieldName,
                    JsonPropertyFieldName = srcProp.JsonPropertyFieldName,
                    PocoName               = srcProp.PocoName,
                    PocoFullName           = srcProp.PocoFullName,
                    PropTypeFullName       = srcProp.TypeFullName,
                    PropUnderlyingTypeName = srcProp.UnderlyingTypeName,
                    PropTypeIsNullable     = srcProp.TypeIsNullable,
                    PropIsUIHidden         = srcProp.IsUIHidden,
                    PropIsKey              = srcProp.IsKeyField,
                    ForeignKeyName         = "", //srcProp.ForeignKeyName,
                    ForeignKeyNameChain    = "",
                    PropIsForeignKey       = srcProp.IsForeignKeyField,
                    ForeignKeyUIType       = srcProp.ForeignKeyUIType,
                    LookUpViewName         = srcProp.LookUpViewName,
                    LookUpFieldName        = srcProp.LookUpFieldName,
                    LookUpId               = srcProp.LookUpId,
                };
                dest.PrimKeys.Add(destPrimKey);
                if (srcProp.ForeigKeyParentProperties == null)
                {
                    continue;
                }
                foreach (PropertySelectorViewModel srcFkp in srcProp.ForeigKeyParentProperties)
                {
                    if (destPrimKey.Navigations == null)
                    {
                        destPrimKey.Navigations = new List <SerializableViewModelForeignKey>();
                    }
                    SerializableViewModelForeignKey dstFkp = new SerializableViewModelForeignKey()
                    {
                        ForeignKeyName             = srcFkp.ForeignKeyName,
                        MasterOriginalPropertyName = srcFkp.OriginalPropertyName,
                        MasterPocoName             = srcFkp.PocoName,
                        MasterPocoFullName         = srcFkp.PocoFullName,
                        MasterTypeFullName         = srcFkp.TypeFullName,
                        MasterUnderlyingTypeName   = srcFkp.UnderlyingTypeName,
                        MasterTypeIsNullable       = srcFkp.TypeIsNullable
                    };
                    destPrimKey.Navigations.Add(dstFkp);
                }
            }
            foreach (ClassFiledSelectorViewModel srcProp in src.ForeigKeyParentProperties)
            {
                SerializableViewModelProperty destProp = null;
                if (srcProp.IncludeInView)
                {
                    if (dest.Properties == null)
                    {
                        dest.Properties = new List <SerializableViewModelProperty>();
                    }
                    destProp = new SerializableViewModelProperty()
                    {
                        OriginalPropertyName  = srcProp.OriginalPropertyName,
                        ViewModelFieldName    = srcProp.ViewModelFieldName,
                        JsonPropertyFieldName = srcProp.JsonPropertyFieldName,
                        PocoName               = srcProp.PocoName,
                        PocoFullName           = srcProp.PocoFullName,
                        PropTypeFullName       = srcProp.TypeFullName,
                        PropUnderlyingTypeName = srcProp.UnderlyingTypeName,
                        PropTypeIsNullable     = srcProp.TypeIsNullable,
                        RefTypeIsNullable      = false,
                        PropIsUIHidden         = srcProp.IsUIHidden,
                        PropIsKey              = srcProp.IsKeyField,
                        ForeignKeyName         = "", //srcProp.ForeignKeyName,
                        ForeignKeyNameChain    = "",
                        PropIsForeignKey       = srcProp.IsForeignKeyField,
                        ForeignKeyUIType       = srcProp.ForeignKeyUIType,
                        LookUpViewName         = srcProp.LookUpViewName,
                        LookUpFieldName        = srcProp.LookUpFieldName,
                        LookUpId               = srcProp.LookUpId,
                    };
                    dest.Properties.Add(destProp);
                }
                if (srcProp.ForeigKeyParentProperties == null)
                {
                    continue;
                }
                if (srcProp.IncludeInView)
                {
                    foreach (PropertySelectorViewModel srcFkp in srcProp.ForeigKeyParentProperties)
                    {
                        if (destProp.Navigations == null)
                        {
                            destProp.Navigations = new List <SerializableViewModelForeignKey>();
                        }
                        SerializableViewModelForeignKey dstFkp = new SerializableViewModelForeignKey()
                        {
                            ForeignKeyName             = srcFkp.ForeignKeyName,
                            MasterOriginalPropertyName = srcFkp.OriginalPropertyName,
                            MasterPocoName             = srcFkp.PocoName,
                            MasterPocoFullName         = srcFkp.PocoFullName,
                            MasterTypeFullName         = srcFkp.TypeFullName,
                            MasterUnderlyingTypeName   = srcFkp.UnderlyingTypeName,
                            MasterTypeIsNullable       = srcFkp.TypeIsNullable,
                            RefTypeIsNullable          = srcProp.TypeIsNullable
                        };
                        destProp.Navigations.Add(dstFkp);
                    }
                }
                dest.AssignFromNavigation(srcProp.TypeIsNullable, "", srcProp, srcProp.ForeigKeyParentProperties);
            }
            return(dest);
        }
 public UserControlVMCFSex(ClassFiledSelectorRootViewModel dataContext)
 {
     InitializeComponent();
     SetDataContext(dataContext);
 }