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

推荐订阅源

The Last Watchdog
The Last Watchdog
博客园 - 司徒正美
L
LangChain Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Security Latest
Security Latest
Microsoft Security Blog
Microsoft Security Blog
Cyberwarzone
Cyberwarzone
Project Zero
Project Zero
M
MIT News - Artificial intelligence
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Troy Hunt's Blog
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
Recent Announcements
Recent Announcements
S
Secure Thoughts
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
Hacker News - Newest:
Hacker News - Newest: "LLM"
雷峰网
雷峰网
Attack and Defense Labs
Attack and Defense Labs
A
About on SuperTechFans
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
Martin Fowler
Martin Fowler
V2EX - 技术
V2EX - 技术
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
B
Blog RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
PCI Perspectives
PCI Perspectives
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hacker News: Front Page

博客园 - 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  

完成。