我有MVC项目和EF6模型.
LazyLoading已启用.在控制器中我有以下动作
public ActionResult AddStage(int projectId, int employeeId)
{
using(var context = new TestProjectEntities())
{
var project = context.Projects.Find(projectId);
if (project != null)
{
var stage = new Stage() {EmployeeID = employeeId, StageType = 1};
project.Stages.Add(stage);
context.Stages.Add(stage);
context.SaveChanges();
}
ListEmployees(project);
}
return Redirect("Index");
}
private void ListEmployees(Project project)
{
var names = new List<string>();
foreach(var stage in project.Stages)
{
if (stage.Employee != null)
{
names.Add(stage.Employee.Name);
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是在foree语句中的ListEmployees方法stage.Employee == null中.为什么?
如果我第二次调用AddStage,那么ListEmployee中的stage.Employee!= null
如何在Windows Phone 8.1中创建透明命令栏这是xaml
<Page x:Class="App3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="White"
mc:Ignorable="d">
<Grid Background="Red" />
<Page.BottomAppBar>
<CommandBar Background="#CCFFFFFF" Foreground="Black">
<CommandBar.PrimaryCommands>
<AppBarButton Label="Button1" />
</CommandBar.PrimaryCommands>
</CommandBar>
</Page.BottomAppBar>
Run Code Online (Sandbox Code Playgroud)
当CommandBar打开时,它具有透明背景,但后面有一个白色面板.热门删除此面板?