当前位置: 首页>>代码示例>>C#>>正文


C# ObjectName.ToString方法代码示例

本文整理汇总了C#中ObjectName.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectName.ToString方法的具体用法?C# ObjectName.ToString怎么用?C# ObjectName.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectName的用法示例。


在下文中一共展示了ObjectName.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BulkCopy

        protected internal override void BulkCopy(DataTable dt, ObjectName destinationTable, SqlBulkCopyOptions options, int? timeout)
        {
            using (SqlConnection con = EnsureConnection())
            using (SqlBulkCopy bulkCopy = new SqlBulkCopy(
                options.HasFlag(SqlBulkCopyOptions.UseInternalTransaction) ? con : (SqlConnection)Transaction.CurrentConnection,
                options,
                options.HasFlag(SqlBulkCopyOptions.UseInternalTransaction) ? null : (SqlTransaction)Transaction.CurrentTransaccion))
            using (HeavyProfiler.Log("SQL", () => destinationTable.ToString() + " Rows:" + dt.Rows.Count))
            {
                bulkCopy.BulkCopyTimeout = timeout ?? Connector.ScopeTimeout ?? this.CommandTimeout ?? bulkCopy.BulkCopyTimeout;

                foreach (DataColumn c in dt.Columns)
                    bulkCopy.ColumnMappings.Add(new SqlBulkCopyColumnMapping(c.ColumnName, c.ColumnName));

                bulkCopy.DestinationTableName = destinationTable.ToString();
                bulkCopy.WriteToServer(dt);
            }
        }
开发者ID:signumsoftware,项目名称:framework,代码行数:18,代码来源:SqlConnector.cs

示例2: RemoveNotificationListener

        public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback)
        {
            int listenerId;
            NotificationSubscription key = new NotificationSubscription(callback, filterCallback, handback);
            if (_listenerProxys.TryGetValue(key, out listenerId))
            {
                _connection.RemoveNotificationListener(_token, name, listenerId);

                _reverseListenerProxys.Remove(listenerId);
                _listenerProxys.Remove(key);

                List<int> listenerGroup = _listenerGroupProxys[callback];
                listenerGroup.Remove(listenerId);
                if (listenerGroup.Count == 0)
                {
                    _listenerGroupProxys.Remove(callback);
                }
            }
            else
            {
                throw new ListenerNotFoundException(name.ToString());
            }
        }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:23,代码来源:RemotingMBeanServerConnection.cs

示例3: Table

 public Alias Table(ObjectName name)
 {
     return new Alias(name.ToString());
 }
开发者ID:rondoo,项目名称:framework,代码行数:4,代码来源:AliasGenerator.cs

示例4: RegisterMBeanInternal

        private ObjectInstance RegisterMBeanInternal(ObjectName name, IDynamicMBean bean)
        {
            IMBeanRegistration registration = new MBeanRegistrationHelper(bean as IMBeanRegistration);
            name = registration.PreRegister(this, name);

            string className = bean.GetMBeanInfo().ClassName;
            TestPermissions(className, null, name, MBeanPermissionAction.RegisterMBean);
            if (_beans.ContainsKey(name))
            {
                registration.PostRegister(false);
                throw new InstanceAlreadyExistsException(name.ToString());
            }
            _beans[name] = bean;
            registration.PostRegister(true);
            _delegate.SendNotification(new MBeanServerNotification(MBeanServerNotification.RegistrationNotification,
                                                                   null, -1, name));
            _domainSet[name.Domain] = true;

            return new ObjectInstance(name, bean.GetMBeanInfo().ClassName);
        }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:20,代码来源:MBeanServer.cs

示例5: GetMBean

 private IDynamicMBean GetMBean(ObjectName name)
 {
     IDynamicMBean bean;
     if (_beans.TryGetValue(name, out bean))
     {
         return bean;
     }
     throw new InstanceNotFoundException(name.ToString());
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:9,代码来源:MBeanServer.cs

示例6: DropPrimaryKeyConstraint

        public static SqlPreCommandSimple DropPrimaryKeyConstraint(ObjectName tableName)
        {
            DatabaseName db = tableName.Schema.Database;

            var tn = tableName.OnDatabase(null);

            string varName = "PrimaryKey_Constraint_" + tn.Name;

            string command = @"
DECLARE @sql nvarchar(max)
SELECT  @sql = 'ALTER TABLE {Table} DROP CONSTRAINT [' + kc.name  + '];' 
FROM DB.sys.key_constraints kc
WHERE kc.parent_object_id = OBJECT_ID('{FullTable}')
EXEC DB.dbo.sp_executesql @sql"
                .Replace("DB.", db == null ? null : (db.ToString() + "."))
                .Replace("@sql", "@" + varName)
                .Replace("{FullTable}", tableName.ToString())
                .Replace("{Table}", tn.ToString());

            return new SqlPreCommandSimple(command);
        }
开发者ID:signumsoftware,项目名称:framework,代码行数:21,代码来源:SqlBuilder.cs

示例7: DropDefaultConstraint

        public static SqlPreCommandSimple DropDefaultConstraint(ObjectName tableName, string columnName)
        {
            DatabaseName db = tableName.Schema.Database;

            var tn = tableName.OnDatabase(null);

            string varName = "Constraint_" + tableName.Name + "_" + columnName;

            string command = @"DECLARE @sql nvarchar(max)
SELECT  @sql = 'ALTER TABLE {Table} DROP CONSTRAINT [' + dc.name  + '];' 
FROM DB.sys.default_constraints dc
JOIN DB.sys.columns c ON dc.parent_object_id = c.object_id AND dc.parent_column_id = c.column_id
WHERE c.object_id = OBJECT_ID('{FullTable}') AND c.name = '{Column}'
EXEC DB.dbo.sp_executesql @sql
"
                .Replace("DB.", db == null ? null : (db.ToString() + "."))
                .Replace("@sql", "@" + varName)
                .Replace("{FullTable}", tableName.ToString())
                .Replace("{Table}", tn.ToString())
                .Replace("{Column}", columnName);

            return new SqlPreCommandSimple(command);
        }
开发者ID:signumsoftware,项目名称:framework,代码行数:23,代码来源:SqlBuilder.cs


注:本文中的ObjectName.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。