惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
D
Docker
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
L
LangChain Blog
H
Help Net Security
B
Blog
T
Tailwind CSS Blog
V
V2EX
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
美团技术团队
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
I
InfoQ
Project Zero
Project Zero
I
Intezer
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
S
Securelist
Recorded Future
Recorded Future
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 叶小钗
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
The Hacker News
The Hacker News

博客园 - KID

Core 1.0中publishOptions Include的bug EF Core 1.0 和 SQLServer 2008 分页的问题 net core 控制台中文乱码的解决方案 Evolution项目(1) asp.net5 Area的处理 asp.net5 操作Cookie 敏捷项目开源管理软件ScrumBasic(1) sharepoint 签入iframe出错的问题 wcf rest security sharepoint2013 错误2 关于html5缓存部分比较详细的说明 sps2013安装错误 sp2013版本区别 httpmodule sharepoint sharepoint session form timeout office2010 x64 Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 800 iphone 流媒体 ad 发光动画
敏捷项目开源管理软件ScrumBasic(2)- 多项目支持
KID · 2016-08-29 · via 博客园 - KID

1.加入Project对象模型

    public class Project
    {
        [Key]
        [MaxLength(32)]
        public string ID { get; set; }
        public string Name { get; set; }
        public int Order { get; set; }
        public ICollection<UserStory> Stories { get; set; }
        public ApplicationUser Creator { get; set; }
        public DateTime CreateTime { get; set; }
        public ApplicationUser Modifier { get; set; }
        public DateTime UpdateTime { get; set; }
    }

2.将Project关联到Story

public ICollection<UserStory> Stories { get; set; }

3.添加projectcontroller

遇到个bug:

 warning CS0169: The field 'UserStoryController.mystr' is never used 
 System.Data.SqlClient.SqlException: Column 'Project.ID' is not the same length or scale as referencing column 'UserStories.ProjectID' in foreign key 'FK_UserStories_Project_ProjectID'. Columns participating in a foreign key relationship must be defined wit h the same length and scale.
Could not create constraint or index. See previous errors.
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 
    at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) 

这是由于系统生成的代码不能识别外键字段长度导致。

fix it

            migrationBuilder.AddColumn<string>(
                name: "ProjectID",
                table: "UserStories",
                maxLength:32,
                nullable: true);

启动。一切正常

 4. 下面来修改 Create New

删除 创建时间和更新时间,改由服务器赋值。

        public async Task<IActionResult> Create(UserStoryViewModel userStoryViewModel)
        {
            if (ModelState.IsValid)
            {
                //mapping   
                UserStory usNew = map.Map<UserStory>(userStoryViewModel);
                usNew.ID = Guid.NewGuid().ToString("N");
                usNew.StatusCode = "Unstarted";
                usNew.Creator = _userManager.FindByNameAsync(User.Identity.Name).Result;
                usNew.CreateTime = DateTime.Now;
                usNew.Order = _context.UserStories.Max(t => t.Order)+1;
                _context.UserStories.Add(usNew);
                await _context.SaveChangesAsync();
                return RedirectToAction("Index");
            }
            return View("OK");
        }

  details 和index删除 createtime

5.menu加入project

6.加入ViewStrories Action

<a asp-action="ViewStories" asp-route-id="@item.ID">View Stories</a> 

7.修改StoryController加入解析id  

完成。