0
데이터베이스 마이그레이션을 위해 마이그레이션을 사용하고 있습니다. 나는 이미 OnModelCreating을 오버 라이딩하여 모든 테이블을 만들었습니다.Asp.Net에서 데이터베이스 마이그레이션을 사용하여 저장 프로 시저를 만드는 방법
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder){
modelBuilder.Entity<AccessLevel>().Map(c =>
{
.ToTable("AccessLevel", "HelpSystem");
c.Properties(p => new
{
p.Id,
p.Name,
p.Description
});
}).HasKey(x => x.Id);
modelBuilder.Entity<AccessLevel>().Property(x => x.Id).HasColumnAnnotation("DatabaseGenerated", DatabaseGeneratedOption.Identity);}
이제 내 데이터베이스에 저장 프로 시저를 만들려고합니다. 내가 어떻게 해? 또한 수
_dataContext.Database.ExecuteSqlCommand("stored procedure sql");
:
이
는 절차CREATE PROCEDURE [HelpSystem].[sp_GetLanguageContentByObject] @InfoObjectId AS BIGINT AS
SELECT io.Id InfoObjectId ,
io.Name InfoObject ,
cc.Id ComChannelId ,
cc.Name ComChannel ,
cc2.Id ContentCategoryId ,
cc2.Name ContentCategory ,
c.Id ContentId ,
c.Name ContentName ,
c.Description ,
c.AuthorPartyId ,
c.DefaultLanguageId ,
c3.CultureCode DefaultLanguage ,
lc.Id LanguageContentId ,
lc.LanguageId ,
c2.CultureCode Language ,
lc.Title ,
lc.Content FROM HelpSystem.InfoPointInfoObject ipio
JOIN HelpSystem.InfoObject io ON io.Id = ipio.InfoObjectId
JOIN HelpSystem.InfoPointComChannel ipcc ON ipcc.InfoPointId = ipio.InfoPointId
JOIN HelpSystem.ComChannel cc ON cc.Id = ipcc.ComChannelId
JOIN HelpSystem.InfoPointContent ipc ON ipc.InfoPointId = ipcc.InfoPointId
JOIN HelpSystem.Content c ON c.Id = ipc.ContentId
JOIN HelpSystem.ContentCategory cc2 ON cc2.Id = c.ContentCategoryId
JOIN HelpSystem.LanguageContent lc ON lc.ContentId = ipc.ContentId
JOIN Localization.Culture c2 ON lc.LanguageId = c2.Id
JOIN Localization.Culture c3 ON c.DefaultLanguageId = c3.Id WHERE ipio.InfoObjectId = @InfoObjectId AND (ipio.ExpireDateTime IS NULL OR ipio.ExpireDateTime > GETUTCDATE()) AND (ipcc.ExpiredDateTime IS NULL OR ipcc.ExpiredDateTime > GETUTCDATE()) AND (ipc.ExpiredDateTime IS NULL OR ipc.ExpiredDateTime > GETUTCDATE())
고마워 .. 이건 나에게 도움이된다 .. :) – user111