首页 \ 问答 \ Visual Studio 2015的Git问题(Git issue with Visual Studio 2015)

Visual Studio 2015的Git问题(Git issue with Visual Studio 2015)

我使用TortoiseGit版本1.8.16.0(git版本2.6.2.windows.1)创建的git存储库中的Visual Studio解决方案

我刚从Visual Studio更新到2015年更新1,并停止跟踪我的文件上的更改。 也不会让我做任何事情。

这是某种已知问题吗? 有什么解决方案吗?


更新

(讽刺的标题...)VS将未保存的文件跟踪为“已更改”,保存的文件显示为“未更改”

切换分支的行为正确,如果有未提交(实际)更改,则会导致错误


更新2

在输出窗口中可能会有与错误有关的任何事情:

开放存储库:

无法打开'C:/ [project path] .VC.opendb':该进程无法访问该文件,因为该进程被另一个进程使用。

无法打开'C:/ [project path] .VC.opendb':该进程无法访问该文件,因为该进程被另一个进程使用。


I have a Visual Studio solution inside a git repository created with TortoiseGit version 1.8.16.0 (git version 2.6.2.windows.1)

I just updated Visual Studio from 2015 to 2015 Update 1, and it stopped tracking changes on my files. also it won't allow me to commit anything.

Is this some sort of a known problem? are there any solutions?


update

(ironic title...) VS tracks unsaved files as "changed" and saved files appear to be "unchanged"

switching branches is behaves correctly and results in an error if there are uncommitted (real )changes


update 2

could this in the output window could have anything to do with the error:

Opening repositories:

Could not open 'C:/[project path].VC.opendb': The process cannot access the file because it is being used by another process.

Could not open 'C:/[project path].VC.opendb': The process cannot access the file because it is being used by another process.


原文:https://stackoverflow.com/questions/34319008
更新时间:2022-05-27 10:05

最满意答案

原因是,对于每条记录,您要检索的是200k记录的国家,这些记录会增加到很多记录中。

您是否打算稍后查询这些数据以减少它以满足您的特定需求? 如果是这样的话.ToList()就是这样。

更改存储库方法以返回IQueryable ,这样您就可以将查询限制为稍后需要的特定数据,从而减少您放入记忆中的数据量

private Entities _context;

public PointsRepository(Entities context)
{
    _context = context
}

public IQueryable<PointsTable> GetAll()
{
    return context.POINTS_TABLE;
}

public IQueryable<PointsTable> GetAllComplete()
{
    return context.POINTS_TABLE.Include("Countries");
}

然后,您可以添加特定的过滤器并将ToList较小的结果。 例如

using (Entities context = new Entities())
{
    var rep = new PointsRepository(context);

    // This will change the query you send to sql to only 
    // retrieve the specific data you want and should result 
    // in much quicker execution
    var result = rep.GetAllComplete()                    // get all with includes
                    .Where(p => p.Property = "Specific") // refine the query 
                    .ToList()                            // retrieve the data and add to memory
}

希望这可以帮助


The reason is that for each record you are retrieving it's countries which for 200k records multiplies into alot of records.

Are you going to querying this data later to reduce it to your specific needs? If so don't .ToList() them just yet.

Change your repository methods to return IQueryable, that way you can restrict the query to the particular data you require later down the line reducing the ammount of data you put into memeory

private Entities _context;

public PointsRepository(Entities context)
{
    _context = context
}

public IQueryable<PointsTable> GetAll()
{
    return context.POINTS_TABLE;
}

public IQueryable<PointsTable> GetAllComplete()
{
    return context.POINTS_TABLE.Include("Countries");
}

You can then add your specific filters and ToList the smaller result. e.g.

using (Entities context = new Entities())
{
    var rep = new PointsRepository(context);

    // This will change the query you send to sql to only 
    // retrieve the specific data you want and should result 
    // in much quicker execution
    var result = rep.GetAllComplete()                    // get all with includes
                    .Where(p => p.Property = "Specific") // refine the query 
                    .ToList()                            // retrieve the data and add to memory
}

Hope this helps

相关问答

更多
  • 简短的回答是否定的,EF不会让你使用Include() 。 想一想,如果它让你这样做:在一种情况下,你的MemberLink.MasterMember.ReceivedMessages将被完全填充,在另一个相同的外观对象MemberLink.MasterMember.ReceivedMessages实际上是一组子消息! 如果您尝试添加到ReceivedMessages会发生什么? 如果添加与过滤器不匹配会怎么样? 这是一袋伤害。 答案是使用预测: public IList
  • 原因是,对于每条记录,您要检索的是200k记录的国家,这些记录会增加到很多记录中。 您是否打算稍后查询这些数据以减少它以满足您的特定需求? 如果是这样的话.ToList()就是这样。 更改存储库方法以返回IQueryable ,这样您就可以将查询限制为稍后需要的特定数据,从而减少您放入记忆中的数据量 private Entities _context; public PointsRepository(Entities context) { _context = context } public ...
  • 这工作正常,但狗慢。 是。 关键是只将真实数据库用于集成测试,这些测试不必经常执行,整套集成测试通常只在构建服务器上执行。 第一次调用时最多可能需要15秒才能创建数据库 这是因为单元测试时EF的初始化很慢 (您可以尝试切换到x86)。 视图生成也消耗时间。 可以预先生成视图 ,这通常是为了减少真实系统的启动和初始化,但是如果使用视图预生成加速单元测试将无济于事,因为您只需将时间从测试转移到构建。 如果有帮助的话,我愿意绕过EF来做这件事,但我想保留我的数据库构建代码而不是回到SQL 四处走动只意味着使用普通 ...
  • 要使用CodeFirst生成视图,请使用EF Power Tools。 在此处查看更多详细信息: http : //blogs.msdn.com/b/adonet/archive/2011/05/18/ef-power-tools-ctp1-released.aspx To generate views with CodeFirst use EF Power Tools. See more details here: http://blogs.msdn.com/b/adonet/archive/2011/0 ...
  • 问题是当你在第一行中调用ToList方法时,你将把所有元素都带到内存中,所以先尝试过滤以避免加载不符合条件的不必要的元素,然后调用ToList方法: var m = a.Merchandisings.Where(f => f.CategoryId == catId).ToList(); The problem is when you call the ToList method in your first line you will bring all the elements to memory, s ...
  • 看起来你在EF中偶然发现了这个错误 。 另一个对bug的引用。 解决方法是删除Include方法。 It looks like you have stumble upon this bug in EF. Another reference to the bug. Workaround would be to remove the Include method.
  • 只要在数据库连接处于活动状态时完成DTO上的所有操作,您根本不需要执行.ToList。 如果需要枚举列表并在db事务之外返回,则只需要执行.ToList。 因此,如果您的代码看起来像这样: 编辑:将存储库更改为服务,因为您不使用存储库 使用(var rep = new service()){var list = rep.GetAll(1); return list.Select(x => new DTOViewModel(x))。ToList(); 你不需要.ToList 如果你的代码看起来像这样: usi ...
  • 这行不正确: query.Where(a => a.ANID == "5F180A0000K0"); 它应该是: query = query.Where(a => a.ANID == "5F180A0000K0"); Where方法是一个返回新IQueryable的函数。 它不会修改调用它的IQueryable。 This line is incorrect: query.Where(a => a.ANID == "5F180A0000K0"); It should be: query = query ...
  • 它是在ToList()调用期间实际立即执行查询。 因此,您之前的Include将在点击数据库之前设置投影 It is during the ToList() call when the query will actually be immediately executed. So, your previous Include will setup the projection before hitting the database
  • 我敢打赌钱,问题出在这一行: where Convert.ToDecimal(g.Sum(p => p.Balance)) != 0m 可能发生的是,它无法将其转换为SQL并静默尝试从db到内存获取所有行,然后在内存对象中进行过滤(LINQ to objects)也许尝试将其更改为: where g.Sum(p=>.Balance!=0) Well, the answer turned out not to be LinqToSQL itself (although possibly the way i ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)