我在VS2015中创建了一个项目,结构如下:
在BookStore.Web中,我可以引用BookStore.ClassLibrary2,但无法引用BookStore.ClassLibrary1.
它显示错误" 无法添加对'ClassLibrary1'的引用. "
我的问题是如何在VS2015中引用类库(包)?非常感谢!
asp.net asp.net-mvc visual-studio asp.net-mvc-5 visual-studio-2015
我创建了一个C#类:
public class books {
public int bookNum { get; set; }
public class book {
public string name { get; set; }
public class record {
public string borrowDate { get; set; }
public string returnDate { get; set; }
}
public record[] records { get; set; }
}
public book[] books { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用XmlSerializer转换为XML字符串时.结果与下面的xml不同.
我的C#类有什么问题?我想使用XmlSerializer输出结果而不是使用XmlDocument.
有任何想法吗?提前致谢!
<books>
<bookNum>2</bookNum>
<book>
<name>Book 1</name>
<record>
<borrowDate>2013-7-1</borrowDate>
<returnDate>2013-7-12</returnDate>
</record>
<record>
<borrowDate>2013-8-1</borrowDate>
<returnDate>2013-8-5</returnDate>
</record>
</book>
<book>
<name>Book 2</name>
<record>
<borrowDate>2013-6-1</borrowDate> …Run Code Online (Sandbox Code Playgroud) 我正在开发 ASP.net Web Form,我想在网站中实现 AutoFac。
我已按照以下链接中的步骤操作: https ://autofaccn.readthedocs.io/en/latest/integration/webforms.html
但我收到了这个错误:
该模块要求 HttpApplication(全局应用程序类)实现 IContainerProviderAccessor。
Global.asax.cs我在我的项目中找不到,只有Global.asax.
Global.asax:
<%@ Application Language="C#" %>
<%@ Import Namespace="Autofac" %>
<%@ Import Namespace="Autofac.Integration.Web" %>
<script RunAt="server">
public class Global : HttpApplication, IContainerProviderAccessor {
// Provider that holds the application container.
static IContainerProvider _containerProvider;
// Instance property that will be used by Autofac HttpModules
// to resolve and inject dependencies.
public IContainerProvider ContainerProvider {
get { return _containerProvider; }
}
void Application_Start(object sender, EventArgs e) …Run Code Online (Sandbox Code Playgroud)