예제 #1
0
        internal static DataColumn CreateColumn(Variable profile, Dictionary <string, List <string> > rbacMetaData, DataObjectStore store)
        {
            DataColumn         dataColumn = new DataColumn(profile.Name);
            Type               type       = null;
            PropertyDefinition value      = null;

            if (profile.PersistWholeObject)
            {
                type = store.GetDataObjectType(profile.DataObjectName);
            }
            else
            {
                store.RetrievePropertyInfo(profile.DataObjectName, profile.MappingProperty, out type, out value);
            }
            dataColumn.DataType = (profile.Type ?? typeof(object));
            Type type2;

            if ((type2 = profile.Type) == null)
            {
                type2 = (type ?? typeof(object));
            }
            profile.Type = type2;
            dataColumn.ExtendedProperties.Add("Variable", profile);
            dataColumn.ExtendedProperties.Add("RealDataType", profile.Type);
            dataColumn.ExtendedProperties.Add("PropertyDefinition", value);
            if (rbacMetaData != null && rbacMetaData.ContainsKey(profile.Name))
            {
                dataColumn.ExtendedProperties.Add("RbacMetaData", rbacMetaData[profile.Name]);
            }
            if (profile.Value != null)
            {
                string value2 = profile.Value as string;
                if (DDIHelper.IsLambdaExpression(value2))
                {
                    dataColumn.ExtendedProperties["LambdaExpression"] = profile.Value;
                }
                else
                {
                    dataColumn.DefaultValue = profile.Value;
                }
            }
            return(dataColumn);
        }