我一直在努力学习这个教程... http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for -an-asp-net-mvc-application但我一直收到以下错误...
system.invalidoperationexception = {"无法为应用程序配置中指定的DbContext类型'WeddingPreparations.Dal.WeddingContext'设置'WeddingPreparations.Dal.WeddingInitializer,KevinLisaWedding'类型的数据库初始化程序.有关详细信息,请参阅内部异常."}
内在的例外是......
{"无法从程序集'EntityFramework,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'加载类型'WeddingPreparations.Dal.WeddingContext'.":"WeddingPreparations.Dal.WeddingContext"}
堆栈跟踪是......
at System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type requiredContextType, String contextTypeName, String initializerTypeName, Boolean isDisabled, Func`1 initializerArgs, Func`3 exceptionMessage)
at System.Data.Entity.Internal.InitializerConfig.<>c__DisplayClass6.<TryGetInitializerFromEntityFrameworkSection>b__1(ContextElement e)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Internal.InitializerConfig.TryGetInitializerFromEntityFrameworkSection(Type contextType)
at System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type contextType)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 t)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type …Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc entity-framework ef-migrations entity-framework-6
我们目前正在运行Jenkins(Hudson)CI服务器来构建和打包我们的.net Web项目和数据库项目.一切都很好但我想开始编写单元测试,然后只有在单元测试通过时才传递构建.我们使用内置的msbuild任务来构建Web项目.有以下论点......
MsBuild Version .NET 4.0
MsBuild Build File ./WebProjectFolder/WebProject.csproj
Command Line Arguments ./target:Rebuild /p:Configuration=Release;DeployOnBuild=True;PackageLocation=".\obj\Release\WebProject.zip";PackageAsSingleFile=True
Run Code Online (Sandbox Code Playgroud)
我们需要在我们的代码上运行自动化测试,这些代码在我们的机器上构建时可能会自动运行(可能是构建后事件),但是当Jenkins为该项目构建时也会运行.
如果你这样运行它不会构建单元测试项目,因为web项目不引用测试项目.测试项目将引用Web项目,但我很确定这将是我们的自动构建,因为它们主要用于构建和打包我们的部署.运行这些测试应该是自动构建和打包过程中的一个步骤.
我们希望在构建主项目时运行测试.但是,对于针对测试项目运行的Web项目添加后期构建事件不起作用,因为Web项目不引用测试项目并且不会触发此项目的构建.我可以继续...但这就够了......
我们花了大约一个星期试图使这项工作很好但没有成功.如果您觉得可以获得更好的回复,请随意编辑此内容...
我一直在做一些阅读http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html和https://michaelbaylon.wordpress.com/2011/04/13/manage-sql-scripts-and-continuous-integration / ...等自动部署和持续集成等等但不是它似乎谈论在经典的asp环境中自动部署,你不能真正做到正确的CI除非你进入自动部署.
MSDeploy可以部署一个经典的asp网站吗?如果不是......最好只编写一个构建脚本,将所有文件复制到正确的文件夹,然后启动IIS?我已经使用msbuild和robocopy msbuild扩展任务完成了这项工作.但是你如何处理不同的环境(QA,dev,staging,production)没有web配置来放置不同的连接字符串等...据说msbuild是配置感知...但是当没有web时它是如何工作的配置?
因此,对于所有这些问题,我正在努力为我们的经典asp网站创建部署脚本/模块/ exe.有没有人有任何答案/资源/进一步的问题,他们可以指向我的方向?
continuous-integration automated-deploy asp-classic msdeploy
我有以下linq查询...
public List<UserProject> GetProjectsByUser(int userid)
{
//var query =
return (
from p in this.Entities.Projects
join c in this.Entities.Categories
on p.CategoryId equals c.CategoryId
join u in this.Entities.Users
on p.UserId equals u.UserId
where p.UserId == 11
select
new
{
p.ProjectId,
u.UserName,
p.UserId,
ProjectName = p.Name,
ProjectDescription = p.Description,
CategoryName = c.Name
}
into pcup
join m in this.Entities.Messages
on
pcup.ProjectId equals m.ProjectId
into pm
select
new {
pcup.ProjectId,
pcup.UserId,
pcup.ProjectName,
pcup.ProjectDescription,
Messages = pm
}
).ToList<UserProject>();
}
Run Code Online (Sandbox Code Playgroud)
我有以下视图对象,我试图填充....
public class UserProject …Run Code Online (Sandbox Code Playgroud)