Cargar columnas con su tipo de dato:
public Dictionary<string, string> GetDictionaryCampos()
{
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("columna1~string", "Ejemplo1");
d.Add("columna2~int", "Ejemplo2");
d.Add("columna3~decimal", "Ejemplo3");
d.Add("columna4~datetime", "Ejemplo4");
return d;
}
Generación XML de reglas agregadas:
Creación de tabla:
BEGIN TRAN
USE [DataBase]
GO
/****** Object: Table [dbo].[RulesManager] Script Date: 04/20/2017 14:57:42 ******/
SET ANSI_NULLS
ON
GO
SET QUOTED_IDENTIFIER
ON
GO
SET ANSI_PADDING
ON
GO
CREATE TABLE
[dbo].[RulesManager](
[ID_Rule]
[int] IDENTITY(1,1) NOT NULL,
[Name]
[varchar](200) NOT NULL,
[CreationDate]
[datetime] NOT NULL,
[ModificationDate]
[datetime] NOT NULL,
[RulesXml]
[xml] NOT NULL,
[RulesHtml]
[nvarchar](max) NOT NULL,
CONSTRAINT
[PK_RulesManager] PRIMARY KEY CLUSTERED
(
[ID_Rule]
ASC
)WITH (PAD_INDEX
= OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS
= ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON
[PRIMARY]
GO
SET ANSI_PADDING
OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N'''''' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'RulesManager', @level2type=N'COLUMN',@level2name=N'Name'
GO
ALTER TABLE
[dbo].[RulesManager] ADD CONSTRAINT
[DF_RulesManager_Name] DEFAULT ('') FOR [Name]
GO
ALTER TABLE
[dbo].[RulesManager] ADD CONSTRAINT
[DF_RulesManager_CreationDate] DEFAULT (getdate()) FOR [CreationDate]
GO
ALTER TABLE
[dbo].[RulesManager] ADD CONSTRAINT
[DF_RulesManager_ModificationDate] DEFAULT (getdate()) FOR [ModificationDate]
GO
ALTER TABLE
[dbo].[RulesManager] ADD CONSTRAINT
[DF_RulesManager_RulesXml] DEFAULT ('') FOR [RulesXml]
GO
ALTER TABLE
[dbo].[RulesManager] ADD CONSTRAINT
[DF_RulesManager_RulesHtml] DEFAULT ('') FOR [RulesHtml]
GO
ROLLBACK
No hay comentarios:
Publicar un comentario