DB 채우기에이 코드가 있지만 완료 후에 DB가 여전히 비어 있습니다. hibernate_unique_key 테이블의 숫자 만 더 높습니다.SharpArch.Data.NHibernate.Repository.SaveOrUpdate() 저장 안 함
다음으로 재미있는 점은 인스턴스를 디버깅하는 동안 ID가 저장되고 1,2,3 ...과 유사하지만 60083, 60084 ... 등과 같이 매우 높다는 것입니다. 저장에는 여러 행만 있기 때문에 정상입니다.
그 전에는 참조 등에서 몇 가지 문제가 있었지만 지금은 오류 메시지 나 예외가 없습니다.
코드가있다 :
using System;
using NHibernate.Cfg;
using SharpArch.Data.NHibernate;
using LaboratorniMetody.Data.NHibernateMaps;
using SharpArch.Core.PersistenceSupport;
using LaboratorniMetody.Core;
namespace LaboratorniMetody.FillSchema
{
class Program
{
private static Configuration configuration;
static void Main(string[] args)
{
configuration = NHibernateSession.Init(new SimpleSessionStorage(), new String[] { "LaboratorniMetody.Data" },
new AutoPersistenceModelGenerator().Generate(),
"../../../../app/LaboratorniMetody.Web/NHibernate.config");
IRepository<Laboratory> LaboratoryRepository = new Repository<Laboratory>();
Laboratory Laboratory1 = new Laboratory() { Name = "Hematologie" };//Method
Laboratory l = LaboratoryRepository.SaveOrUpdate(Laboratory1);
Laboratory Laboratory2 = new Laboratory() { Name = "Patologie" };//Method
LaboratoryRepository.SaveOrUpdate(Laboratory2);
Laboratory Laboratory3 = new Laboratory() { Name = "Laboratoře" };//Method
LaboratoryRepository.SaveOrUpdate(Laboratory3);
}
}
}
내가 Project.Core 클래스에서 NUnit를하여 genereted DB 스키마를 사용합니다.
어디서 문제를 찾을 수 있습니까? 나는 문제없이 일하는 2 개의 매우 유사한 프로젝트를 가지고있다. 나는이 코드 중 하나에서이 코드를 복사했으며 DB 모델을 제외하고 전혀 다른 점이 없다.
최고입니다. 하지만 이전 구버전에서 오래된 코드가 작동하고 새로운 코드에서 작동하지 않는 이유는 여전히 남아 있습니다. –
이전 코드와 새 코드의 차이점은 무엇입니까? 그것이 문제를 해결하는 데 도움이된다면 대답을 upvote하십시오. –