public unsafe T GetProperty <T>(AdapterProperty property) where T : unmanaged
        {
            T result = default;

            GetProperty(property, sizeof(T), new IntPtr(&result)).CheckError();
            return(result);
        }
        public unsafe bool GetBoolProperty(AdapterProperty property)
        {
            bool result = default;

            GetProperty(property, 1, new IntPtr(&result)).CheckError();
            return(result);
        }
    public bool GetBoolProperty(AdapterProperty property)
    {
        bool result = default;

        GetProperty(property, 1, &result).CheckError();
        return(result);
    }
        public unsafe string GetStringProperty(AdapterProperty property)
        {
            GetPropertySize(property, out PointerSize propertySize).CheckError();
            byte *strBytes = stackalloc byte[propertySize];

            GetProperty(property, propertySize, new IntPtr(strBytes)).CheckError();
            return(System.Text.Encoding.UTF8.GetString(strBytes, propertySize - 1));
        }
        public unsafe Result GetProperty <T>(AdapterProperty property, out T propertyData) where T : unmanaged
        {
            fixed(void *pPropertyData = &propertyData)
            {
                Result result = GetProperty(property, sizeof(T), new IntPtr(pPropertyData));

                return(result);
            }
        }
Пример #6
0
        /// <summary>
        /// Sets a non-public property for advanced scenarios.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="value">The value to assign.</param>
        public void SetProperty(AdapterProperty propertyName, object value)
        {
            switch (propertyName)
            {
            case AdapterProperty.TableName:
                CommandBuilder.TableName = (string)value;
                return;

            case AdapterProperty.SaveToTable:
                CommandBuilder.SaveToTable = (string)value;
                return;

            case AdapterProperty.UseQuotedIdentifiers:
                CommandBuilder.UseQuotedIdentifier = (bool?)value;
                return;
            }
        }
Пример #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            AdapterProperty ap = pgCS.SelectedObject as AdapterProperty;

            try
            {
                var provider = Burst.Data.DbProvider.Initialize(ap.Parameters);
                if (provider != null)
                {
                    selected = cbAdapter.SelectedIndex;
                    Wizard.InitializeParameters = ap.Parameters;
                    Wizard.Schema = provider.Schema;
                    Wizard.NextStep();
                }
                else
                {
                    MessageBox.Show("无法使用指定的设置连接到数据库。");
                }
            }
            catch
            {
                MessageBox.Show("无法使用指定的设置连接到数据库。");
            }
        }
 public PointerSize GetPropertySize(AdapterProperty property)
 {
     GetPropertySize(property, out PointerSize propertySize).CheckError();
     return(propertySize);
 }
Пример #9
0
 set => SetValue(AdapterProperty, value);