Beispiel #1
0
        private IFunctionData AddMissingProperties(IFunctionData data)
        {
            var connectionType = ConnectionType.OleDb;

            if (data.Properties[DbShared.ConnectionStringPropertyName].Value is string)
            {
                connectionType = DatabaseAssistant.DetectConnectionType(data.Properties[DbShared.ConnectionStringPropertyName].Value as string) ?? ConnectionType.OleDb;
            }

            if (data.FindPropertyById(DbShared.ConnectionTypePropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.ConnectionTypePropertyName, typeof(ConnectionType), ValueUseOption.DesignTime, ConnectionType.SqlServer)
                {
                    Value = connectionType
                });
            }

            if (data.FindPropertyById(DbShared.DesignTimeConnectionTypePropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.DesignTimeConnectionTypePropertyName, typeof(ConnectionType), ValueUseOption.DesignTime, ConnectionType.SqlServer)
                {
                    Value     = connectionType,
                    IsVisible = false
                });
            }

            if (data.FindPropertyById(DbShared.DesignTimeConnectionStringPropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.DesignTimeConnectionStringPropertyName, typeof(string), ValueUseOption.DesignTime, string.Empty)
                {
                    IsVisible = false
                });
            }

            return(data);
        }