随笔-76  评论-629  文章-1 

『开源』Slithice 2013 服务器集群 设计和源码

相关介绍文章:

『设计』Slithice 分布式架构设计-支持一体式开发,分布式发布

『集群』001 Slithice 服务器集群 概述

『集群』002 Slithice 集群配置工具 的使用

『集群』003 Slithice 最简分布式(多个客户端,一个独立服务端)

『集群』004 Slithice 集群分布式(多个客户端,基于中央服务器的多个集群服务端)

『集群』005 Slithice 基于 集群 的 自动容错

『集群』006 Slithice 后期改进 和 Slithice可能存在的BUG

『集群』007 如何测试Slithice源代码

 

 版本库:

 

Slithice是做什么的

Slithice 是一个 跨平台 的 分布式架构 框架;

旨在简化 分布式开发 的开发难度,节省 开发成本 和 后期维护成本;

并提供 稳定 的分布式容错机制;

其 界面化的集群配置,一体式开发&分布式发布,插件覆盖,容错调度 是 Slithice 最大的亮点;

Slithice 提供 任意 程序集,任意命名空间,任意类名 的 扩展,包括:

配置数据获取方式的扩展(从 什么地方 找寻 服务器配置数据);

调度方式的扩展(比如WCFSocketWebService等);

功能插件的扩展(这个就是 最重要的了);

Ps. Slithice 并非 只 针对 集群服务器,同时 Slithice 也支持 最简单的 一个服务端&多个客户端 的 最简分布式;

 

Slithice名字的由来

Slithice  DotA 故事中,娜迦海妖 的名字 —— 只是因为 半年前 练习 小娜迦,所以 才 选取了这个名字;

 

Slithice的版本演化

之前时间,Slithice 的 架构设想 闪现于脑海,于是 整理了最简单的 设计手稿 和 实现目标

2013-02-10    Project版本库    正式动工     取名 Slithice 2013     累计耗时20小时,完成 先行版 Demo

2013-06-10    Laura版本库      项目迁移     维持原名                  累计耗时60小时,完成 现在版本;

 

Slithice的目标

Slithice 的 基本目标 就是 简化 集群分布式 开发;

Slithice 的 终极目标 就是 跨平台:

服务端 可以用 .NetJava 等开发;

客户端 可以用 .Net-PC.Net-WinCE.Net-WinPhoneJavaAndroidIPhone 等开发;

—— 想必,这是 极好的;

 

顺带提一下 Slithice 的序列化

Slithice 支持 .Net 自带的序列化(不能跨WinCE等平台) 和 Laura.Serialization 序列化 —— 没有使用架构;

Laura.Serialization 是 作者顺手 累计 30小时 完成的 一个 序列化算法;

       Laura.Serialization 支持 .Net-PC.Net-WinCE 两个平台;

       Laura.Serialization 序列化的 byte[] 结构分为:类型区,数据区,结构区

       Laura.Serialization 设计思想,只要对 类型区 进行控制:基本就能实现 跨 JavaAndroid 等 其他平台;

       Laura.Serialization 作者顺手 5小时,写了一个 Json 序列化算法(用 字符串 跨平台 显得容易很多)

 

Slithice集群配置工具 主界面

在测试 Slithice  Demo 中,我配置了 7个服务端:

一个 WCF 的 中央服务端;

两个 WCF 的 成员服务端(私有 – 前面有一个棕色皮包的图标);

两个 Socket 的 成员服务端;

两个 WebService 的 成员服务端;

 

Slithice集群配置工具 配置界面

配置界面.jpg

我们看到的是 WebService_002 的 配置

>蓝色区域 里面的 是 当前服务端 自己可以处理的 Action

       >红色区域 里面的 是 当前服务端 自己不能处理,但是 可以 调度出去的 Action

       >紫色区域 里面的 是 当前服务器 可以调度 的 子服务器(就是 两个 WCF 服务);

       >按照 Slithice 的设计思想:能够自己处理的任务,除了强制指定任务的服务器外,基本都会自己处理,自己处理不了的,才会进行调度;

 

上面 展示的 是 WebService_002 可以调度 出去的 Action

>TestAction_001TestAction_002 两个 子服务器 都可以 调度;

>TestAction_1_001TestAction_1_002 只有 ConsoleWCFService_001 可以调度;

>这里,做了一个 BUG配置:我们将 Slithice_ResetService(重置服务器) 的功能 没有 勾选为自己处理,结果 重置服务器 的功能 也将会 被调度;(Slithice 内置的 Action插件 并没有 特权)

       >调度几率:在配置 服务端 时候,可以按照 服务端 所在的 硬件设备 的处理能力 设置 这个值,默认 100000;当 对一个 服务端的 调度 出现错误时,该值 会 -1,调度成功时,该值 会 +1 —— 调度几率,决定了 同一个任务可以多个调度 时的 调度几率;

 

Slithice集群配置工具 插件覆盖界面

上面 展示的 是 插件覆盖界面;

>ConsoleCenterService 具有 几个 自定义Action

>其中,TestAction_Center_001 有两个版本, 他们是 同键值的,但是 最终被启用 的是优先级 更高的 100010

>插件 优先级 的设置,为了 避免问题,可以 使用 yyMMddHH 这种模式;

>Slithice 内置 Action 是没有特权的:Slithice内置Action 也是可以被覆盖的 —— 当然,还是有 多少 的 特殊处理:

Slithice 内置 Action 优先级 最大值可以是 Int64.MaxValue

              自定义 Action 优先级 最大值可以是 Int32.MaxValue

 

Slithice集群配置工具 单元测试界面

上面 展示的 是 单元测试界面;

       >因为 时间比较急,所以 插件执行时需要的参数 这个功能 并没有实现;

       >因为 时间比较急,所以 插件测试的是 服务端本地固有Action 的 测试,并不包括 服务端 可调度 的 Action 测试;

       >因为 时间比较急,所以 性能压力 测试 的功能 并没有实现;


Slithice 是开源的

Slithice 的 作者 是 舒小龙;

Slithice 是开源的,任何 企业 或 个人 都可以 无偿 用于 商业 或 非商业 用途;

当然,作者希望 各位 能在 舒小龙 的 个人博客 或者 博客园 回复一哈:使用者名称+软件名称+邮箱(可选)

为什么要开源:

北京公司,在 抽烟室 和 马瑞礼(马哥) 聊天中,就聊到了这个话题,当时 马哥的回答 让自己 有所顿悟:

今天自己的代码 比起 几年前 成长了不少,当初的 王牌代码 在今天也 不过如此

—— 未来几年后,今天的代码 或许 在未来 也只是 “不过如此”;

所在的 角度 和 高度 在 提升,思想也就不一样 吧;

 

最最重要的是:王牌代码 给不了 一个人 未来,能成就一个人未来的 是 合作共赢 的力量;

Ps. 感谢那段时间 马哥 那次关于“开源”的讨论,也感谢那段时间 马哥 在人生 道路上 对我的 各种指点,还有那次的宽容,收益很深;

 

源码下载

Slithice 2013 所有源码和文档

 

                                                                                                               舒小龙

                                                                                                       2014-03-13 01:34


 
Ps.为了 数据库附加 版本不同,所以 提供 数据表 结构和数据 脚本
USE [LauraBlog]
GO
/****** Object:  Table [dbo].[SL_TransferServiceConfig]    Script Date: 03/19/2014 20:57:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SL_TransferServiceConfig](
    [FId] [int] IDENTITY(1,1) NOT NULL,
    [FPrevServiceName] [nvarchar](250) NOT NULL,
    [FServiceName] [nvarchar](250) NOT NULL,
    [FTransferType] [nvarchar](150) NOT NULL,
    [FTransferArguments] [ntext] NOT NULL,
    [FTransferProbability] [int] NOT NULL,
    [FHandleModules] [ntext] NOT NULL,
 CONSTRAINT [PK_SL_TransferServiceConfig] PRIMARY KEY CLUSTERED 
(
    [FId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[SL_TransferServiceConfig] ON
INSERT [dbo].[SL_TransferServiceConfig] ([FId], [FPrevServiceName], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules]) VALUES (64, N'WebService_001', N'ConsoleWCFService_001', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:40000/SlithiceService/CalculateWinService;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_001|TestAction_002|TestAction_1_001|TestAction_1_002')
INSERT [dbo].[SL_TransferServiceConfig] ([FId], [FPrevServiceName], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules]) VALUES (65, N'WebService_002', N'ConsoleWCFService_001', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:40000/SlithiceService/CalculateWinService;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_001|TestAction_002|TestAction_1_001|TestAction_1_002')
INSERT [dbo].[SL_TransferServiceConfig] ([FId], [FPrevServiceName], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules]) VALUES (66, N'WebService_002', N'ConsoleWCFService_002', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:50000/SlithiceService/CalculateWinService;TransferType=NetWcfBinary;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_001|TestAction_002|TestAction_2_001|TestAction_2_002')
SET IDENTITY_INSERT [dbo].[SL_TransferServiceConfig] OFF
/****** Object:  Table [dbo].[SL_SlithiceServiceConfig]    Script Date: 03/19/2014 20:57:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SL_SlithiceServiceConfig](
    [FId] [int] IDENTITY(1,1) NOT NULL,
    [FServiceName] [nvarchar](250) NOT NULL,
    [FTransferType] [nvarchar](150) NOT NULL,
    [FTransferArguments] [ntext] NOT NULL,
    [FTransferProbability] [int] NOT NULL,
    [FHandleModules] [ntext] NOT NULL,
    [FTransferModules] [ntext] NOT NULL,
    [FIsPrivate] [bit] NOT NULL,
    [FEnable] [bit] NOT NULL,
 CONSTRAINT [PK_SL_SlithiceServiceConfig] PRIMARY KEY CLUSTERED 
(
    [FId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[SL_SlithiceServiceConfig] ON
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (133, N'ConsoleCenterService', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:30000/SlithiceService/CalculateWinService;TransferType=NetWcfBinary;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_Center_001|TestAction_Center_002', N'', 0, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (134, N'ConsoleSocketService_001', N'NetSocket', N'ServiceAddress=127.0.0.1;ServicePort=31000;TransferType=NetSocket;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState', N'', 0, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (135, N'ConsoleSocketService_002', N'NetSocket', N'ServiceAddress=127.0.0.1;ServicePort=32000;TransferType=NetSocket;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState', N'', 0, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (136, N'ConsoleWCFService_001', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:40000/SlithiceService/CalculateWinService;TransferType=NetWcfBinary;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_001|TestAction_002|TestAction_1_001|TestAction_1_002', N'', 1, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (137, N'ConsoleWCFService_002', N'NetWcfBinary', N'EndpointAddress=net.tcp://127.0.0.1:50000/SlithiceService/CalculateWinService;TransferType=NetWcfBinary;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_001|TestAction_002|TestAction_2_001|TestAction_2_002', N'', 1, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (139, N'WebService_001', N'NetWebService', N'WebServiceUrl=http://localhost:5447/SlithiceWebService.asmx;TransferType=NetWebService;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState', N'TestAction_001|TestAction_002|TestAction_1_001|TestAction_1_002', 0, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (140, N'WebService_002', N'NetWebService', N'WebServiceUrl=http://localhost:5451/SlithiceWebService.asmx;TransferType=NetWebService;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ServiceState|Slithice_ValueState', N'Slithice_ResetService|TestAction_001|TestAction_002|TestAction_1_001|TestAction_1_002|TestAction_2_001|TestAction_2_002', 0, 1)
INSERT [dbo].[SL_SlithiceServiceConfig] ([FId], [FServiceName], [FTransferType], [FTransferArguments], [FTransferProbability], [FHandleModules], [FTransferModules], [FIsPrivate], [FEnable]) VALUES (141, N'WebCenterService', N'NetWebService', N'WebServiceUrl=http://localhost:9183/SlithiceWebService.asmx;TransferType=NetWebService;', 100000, N'Slithice_About|Slithice_CenterService_DeleteSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfig|Slithice_CenterService_GetSlithiceServiceConfigs|Slithice_CenterService_SaveSlithiceServiceConfig|Slithice_HandleAndTransferModules|Slithice_InherentHandleModuleInfos|Slithice_InherentHandleModules|Slithice_ResetService|Slithice_ServiceState|Slithice_ValueState|TestAction_Center_003', N'', 0, 1)
SET IDENTITY_INSERT [dbo].[SL_SlithiceServiceConfig] OFF
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FServiceName]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FServiceName]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FServiceName]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FServiceName]  DEFAULT ('') FOR [FServiceName]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FTransferType]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FTransferType]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FTransferType]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FTransferType]  DEFAULT ('') FOR [FTransferType]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FTransferArguments]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FTransferArguments]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FTransferArguments]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FTransferArguments]  DEFAULT ('') FOR [FTransferArguments]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FTransferProbability]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FTransferProbability]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FTransferProbability]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FTransferProbability]  DEFAULT ((100000)) FOR [FTransferProbability]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FHandleModules]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FHandleModules]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FHandleModules]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FHandleModules]  DEFAULT ('') FOR [FHandleModules]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FTransferModules]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FTransferModules]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FTransferModules]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FTransferModules]  DEFAULT ('') FOR [FTransferModules]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FIsPrivate]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FIsPrivate]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FIsPrivate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FIsPrivate]  DEFAULT ((0)) FOR [FIsPrivate]
END


End
GO
/****** Object:  Default [DF_SL_SlithiceServiceConfig_FEnable]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_SlithiceServiceConfig_FEnable]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_SlithiceServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_SlithiceServiceConfig_FEnable]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_SlithiceServiceConfig] ADD  CONSTRAINT [DF_SL_SlithiceServiceConfig_FEnable]  DEFAULT ((1)) FOR [FEnable]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FPrevServiceName]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FPrevServiceName]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FPrevServiceName]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FPrevServiceName]  DEFAULT ('') FOR [FPrevServiceName]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FServiceName]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FServiceName]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FServiceName]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FServiceName]  DEFAULT ('') FOR [FServiceName]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FHandleType]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FHandleType]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FHandleType]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FHandleType]  DEFAULT ('') FOR [FTransferType]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FArguments]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FArguments]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FArguments]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FArguments]  DEFAULT ('') FOR [FTransferArguments]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FTransferProbability]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FTransferProbability]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FTransferProbability]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FTransferProbability]  DEFAULT ((100000)) FOR [FTransferProbability]
END


End
GO
/****** Object:  Default [DF_SL_TransferServiceConfig_FHandleModules]    Script Date: 03/19/2014 20:57:31 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_SL_TransferServiceConfig_FHandleModules]') AND parent_object_id = OBJECT_ID(N'[dbo].[SL_TransferServiceConfig]'))
Begin
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SL_TransferServiceConfig_FHandleModules]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SL_TransferServiceConfig] ADD  CONSTRAINT [DF_SL_TransferServiceConfig_FHandleModules]  DEFAULT ('') FOR [FHandleModules]
END


End
GO
View Code

 

posted on 2014-03-18 11:13 InkFx 阅读(...) 评论(...) 编辑 收藏