更新时间:2022-05-03 20:23:19
<connectionStrings> <add name="RFConnectionString" connectionString="Data Source=Esint-lhj\Sql2005;Initial Catalog=AdventureWorksDW;Persist Security Info=True;User ID=sa;Password=" providerName="System.Data.SqlClient" /> </connectionStrings>
public partial class DimGeography { public DimGeography() { } public DimGeography(System.String city, System.String countryRegionCode, System.String englishCountryRegionName,
System.String frenchCountryRegionName, System.Int32 geographyKey, System.String postalCode,
Nullable<System.Int32> salesTerritoryKey, System.String spanishCountryRegionName, System.String stateProvinceCode,
System.String stateProvinceName) { this.cityField = city; this.countryRegionCodeField = countryRegionCode; this.englishCountryRegionNameField = englishCountryRegionName; this.frenchCountryRegionNameField = frenchCountryRegionName; this.geographyKeyField = geographyKey; this.postalCodeField = postalCode; this.salesTerritoryKeyField = salesTerritoryKey; this.spanishCountryRegionNameField = spanishCountryRegionName; this.stateProvinceCodeField = stateProvinceCode; this.stateProvinceNameField = stateProvinceName; } private System.String cityField; public System.String City { get { return this.cityField; } set { this.cityField = value; } } private System.String countryRegionCodeField; public System.String CountryRegionCode { get { return this.countryRegionCodeField; } set { this.countryRegionCodeField = value; } } private System.String englishCountryRegionNameField; public System.String EnglishCountryRegionName { get { return this.englishCountryRegionNameField; } set { this.englishCountryRegionNameField = value; } } private System.String frenchCountryRegionNameField; public System.String FrenchCountryRegionName { get { return this.frenchCountryRegionNameField; } set { this.frenchCountryRegionNameField = value; } } private System.Int32 geographyKeyField; public System.Int32 GeographyKey { get { return this.geographyKeyField; } set { this.geographyKeyField = value; } } private System.String postalCodeField; public System.String PostalCode { get { return this.postalCodeField; } set { this.postalCodeField = value; } } private Nullable<System.Int32> salesTerritoryKeyField; public Nullable<System.Int32> SalesTerritoryKey { get { return this.salesTerritoryKeyField; } set { this.salesTerritoryKeyField = value; } } private System.String spanishCountryRegionNameField; public System.String SpanishCountryRegionName { get { return this.spanishCountryRegionNameField; } set { this.spanishCountryRegionNameField = value; } } private System.String stateProvinceCodeField; public System.String StateProvinceCode { get { return this.stateProvinceCodeField; } set { this.stateProvinceCodeField = value; } } private System.String stateProvinceNameField; public System.String StateProvinceName { get { return this.stateProvinceNameField; } set { this.stateProvinceNameField = value; } } }
---------------------------------------------------------------- -- [dbo].[DimGeography] Table -- IF NOT EXISTS (SELECT NAME FROM sys.objects WHERE TYPE = 'P' AND NAME = 'InsertDimGeography') BEGIN EXEC('CREATE PROCEDURE [dbo].[InsertDimGeography] AS RETURN') END GO ALTER PROCEDURE [dbo].[InsertDimGeography] @city nvarchar(30) = NULL, @countryRegionCode nvarchar(3) = NULL, @englishCountryRegionName nvarchar(50) = NULL, @frenchCountryRegionName nvarchar(50) = NULL, @geographyKey int OUT, @postalCode nvarchar(15) = NULL, @salesTerritoryKey int, @spanishCountryRegionName nvarchar(50) = NULL, @stateProvinceCode nvarchar(3) = NULL, @stateProvinceName nvarchar(50) = NULL AS BEGIN SET NOCOUNT ON BEGIN TRY INSERT INTO [dbo].[DimGeography] ([City], [CountryRegionCode], [EnglishCountryRegionName], [FrenchCountryRegionName], [PostalCode], [SalesTerritoryKey], [SpanishCountryRegionName], [StateProvinceCode], [StateProvinceName]) VALUES (@city, @countryRegionCode, @englishCountryRegionName, @frenchCountryRegionName, @postalCode, @salesTerritoryKey, @spanishCountryRegionName, @stateProvinceCode, @stateProvinceName) SET @geographyKey = SCOPE_IDENTITY() END TRY BEGIN CATCH EXEC RethrowError; END CATCH SET NOCOUNT OFF END GO
使用Repository Factory生成业务实体和存储过程,就介绍到这里,限于篇幅,
,如需转载请自行联系原作者