我正在从集中式SCM系统切换到GIT.好的,我承认哪一个,它是Visual SourceSafe.因此,除了克服Git命令和工作流的学习曲线之外,我目前面临的最大问题是如何将我们当前的存储库迁移到Git,关于单个或某些类型的多个存储库.
我已经通过各种方式看到了这个问题,但通常只是基本..."我有应用程序想要共享一些较低级别的库"并且预制响应总是"使用单独的存储库"和/或"使用Git子模块"没有太多解释何时/为什么应该使用这种模式(它克服了什么,它消除了什么?)从我对Git的有限知识/阅读到目前为止,似乎子模块可能有自己的恶魔来战斗,特别是对于刚接触Git的人.
然而,我还没有看到有人公然问的是,"如果你有传统的n层开发(UI,业务,数据,然后是共享工具),每个层都是自己的项目,你应该使用一个或多个库?" 我不清楚,因为几乎总是,当添加一个新的"功能"时,代码更改会波及每一层.
为了使与Git相关的问题复杂化,我们在"框架"中复制了这些层,以便从开发人员的角度制定更易于管理的项目/组件.出于本讨论的目的,我们将这些项目/图层集合称为"Tahiti",它代表整个"产品".
我们设置的最后一个"层"是增加了对塔希提岛进行定制/扩展的客户网站/项目.在文件夹结构中表示这可能最像是:
/Clients
/Client1
/Client2
/UI Layer
/CoreWebsite (views/models/etc)
/WebsiteHelper (contains 'web' helpers appropriate for any website)
/Tahiti.WebsiteHelpers (contains 'web' helpers only appropriate for Tahiti sites)
/BusinessLayer (logic projects for different 'frameworks')
/Framework1.Business
/Framework2.Business
/DataLayer
/Framework1.Data
/Framework2.Data
/Core (projects that are shared tools useable by any project/layer)
/SharedLib1
/SharedLib2
Run Code Online (Sandbox Code Playgroud)
在解释了我们如何通过多个项目扩展传统的n层设计之后,我正在寻找任何关于你在类似情况下做出的决定的经验(甚至简单的用户界面,业务,数据分离就是你的全部因为你的决定,更容易/更难.在初步阅读中,子模块有多痛苦,我是否正确?比痛苦更有益吗?
我的直觉反应是塔希提岛的一个存储库(所有项目除了'客户项目'),然后是每个客户的一个存储库.我猜的整个大溪地来源必须是<10k文件.这是我的推理(我欢迎批评)
提前致谢.
git visual-sourcesafe repository repository-design visual-studio
我一直在网上搜索而没有找到任何答案(关于堆栈溢出有几个接近的问题,但它们似乎没有得到答案或相同),所以我认为我会构成我自己的一个.它围绕嵌套母版页和访问祖父母大师的Content PlaceHolder的内容页面展开,即使它没有在父嵌套母版中重新公开.我想知道这是不可能的.
Core Site.Master
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>
<asp:ContentPlaceHolder ID="TitleContent" runat="server">
<%= Html.GlobalModel().PageTitle %>
</asp:ContentPlaceHolder>
</title>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
<link rel="shortcut icon"
href="<%= ViewContext.ClientContent( "Content/Tiki.ico" ) %>"
type="image/x-icon"/>
</asp:ContentPlaceHolder>
</head>
<body>
<asp:ContentPlaceHolder ID="SiteContent" runat="server"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
嵌套的Site.Master(请注意TitleContent和HeadContent是如何自定义的,因此来自Core Site.Master的'默认'内容应该生效)
<%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewMasterPage" %>
<asp:Content ContentPlaceHolderID="SiteContent" runat="server">
<asp:ContentPlaceHolder ID="SiteContent" runat="server">
<h1>Nested Header</h1>
<asp:ContentPlaceHolder ID="NestedContent" runat="server"/>
</asp:ContentPlaceHolder>
</asp:ContentPlaceHolder>
Run Code Online (Sandbox Code Playgroud)
ContentView.aspx(引用嵌套的Site.Master,尝试的TitleContent替换将不起作用.)
<%@ Page Language="C#" MasterPageFile="Site.Master" %>
<asp:Content ContentPlaceHolderID="NestedContent" runat="server">
<p>Nested content. This will work.</p>
</asp:Content>
<asp:Content ContentPlaceHolderID="TitleContent" runat="server"> …
Run Code Online (Sandbox Code Playgroud) 我们公司的工作流程是在我们处理新功能时将主分支克隆到_Test分支,并且我们不断推送/共享此_Test分支,直到客户完成并批准一组功能,然后我们合并到主分支并构建和发布我们的站点.然后冲洗并重复.
我遇到的问题是git状态在_Test分支上工作时没有显示正确的前进/后退(或者更可能,我可能不理解它应该显示的内容).如果我执行以下步骤:
在第四步之后,git输出是
[_Test d6fa824] Test commit
1 file changed, 1 insertion(+), 1 deletion(-)
Run Code Online (Sandbox Code Playgroud)
然后在第五步之后,git输出
# On branch _Test
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
不应该说吗?
Your branch is ahead of 'origin/_Test' by 1 commit.
Run Code Online (Sandbox Code Playgroud)
如果我查看qgit或gitk,它们分别(正确地)显示origin/_Test和remotes/origin/_Test,在最后一次测试提交后提交1次.我正在运行msysgit和git版本输出:
git version 1.8.1.mysysgit.1
Run Code Online (Sandbox Code Playgroud)
所以我很困惑为什么git commit的输出没有声明我超前于origin/_Test(显然我是因为我刚刚提交)以及为什么git status不会声明相同的信息.
如果我需要提供更多信息,请告诉我.
有没有办法读取/获取“当前范围”值?例如,我在 IPageFilter 中添加了一些“全局上下文”值:
// OnPageHandlerExecuting
var contextScopeValues = new Dictionary<string, object>
{
{ "UserId", "user-id-value" }
};
contextScope = logger.BeginScope( contextScopeValues );
// OnPageHandlerExecuted
contextScope?.Dispose();
Run Code Online (Sandbox Code Playgroud)
如果我logger.LogInformation( "Doing something for {UserId}" );
在任何页面处理期间调用,这将起作用并且消息将使用正确的UserId
.
但是,在使用 时LoggerMessage
,如果没有字符串参数,它会引发解析错误。
public static class LoggerMessages
{
private static readonly Action<ILogger> sampleActivity;
static LoggerMessages()
{
// This line throw exception because a parameter was 'expected'
sampleActivity = LoggerMessage.Define( "Start some activity for {UserId}" );
}
public static void SampleActivity( this ILogger logger ) …
Run Code Online (Sandbox Code Playgroud) 假设我已经从c:\中完成了以下操作,从远程来源获取最新代码的正确方法是什么?
# Create repo...
mkdir Test
cd Test
git init
...create files
git add .
git commit -a -m "Init Commit"
# Clone repo...
cd ..
git clone Test TestClone
# Edit original
cd Test
...edit files
git commit -a -m "Init Edit"
# Go back to Clone
cd ..\TestClone
# Get latest code
# Now what??? pull or update then pull
Run Code Online (Sandbox Code Playgroud) 在最近从Excel 2010升级到Excel 2013之后,我将自定义加载项(.xlam)移动到新的Application.LibraryPath目录(C:\ Program Files\Microsoft Office 15\root\office15\Library\BTRTools).有一些代码启动可执行(exe)文件(位于加载项的子目录中).但是,自升级/移动以来,我没有收到错误:
PrettyPrintXml.exe - Application Error
The application was unable to start correctly (0xc000007b). Click OK to close the application.
我显然很相信它是文件权限.我已经明确添加了自己的权限,拥有\ Library文件夹(以及所有潜艇)的完全权限.请注意,我认为即使使用Excel 2010(C:\ Program Files(x86)\ Microsoft Office\Office14\Library中的文件夹)也必须这样做才能使工作正常.
但是,经过这一切,我仍然卡住了,无法启动exe文件.关于如何使这项工作的任何想法/建议?
代码非常标准:
Public Sub RunShellExecute(sFile As String, Optional params As String = "", Optional wait As Boolean = False)
Dim wsh As Object: Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = wait
Dim windowStyle As Integer: windowStyle = 1
Dim exe As String: exe = IIf(Left(sFile, …
Run Code Online (Sandbox Code Playgroud) .NET Core 中无键查询字符串参数的替换是什么?
在 asp.net 中,语法为Request.QueryString[ null ]
,但是 .NET Core 会为此抛出 null 异常,不允许您传入null
键名称。
例如,我需要支持这种格式的url:
http://localhost:54301/RBLeCORS.ashx?{Command:CalcEngineStatus}
然而,除此之外,我需要能够处理通过$.ajax()
javascript 调用发布的命令,其中数据被发布而不是放在查询字符串上。
其中 keyless(我看到评论想将其称为 valueless,我猜这适合 .NET Core,但我看到它们被称为 keyless,用于您使用密钥访问的 asp.net b/c null
)值是一个 json 对象,可以具有不仅仅是我给出的这个简单的例子。
更新:这是我作为解决方法所做的当前代码。
string queryData = null;
if (context.Request.Query.Count == 1 )
{
var firstKey = context.Request.Query.Keys.ElementAt(0);
var firstValue = context.Request.Query[firstKey];
if ( string.IsNullOrEmpty( firstValue ) )
{
queryData = firstKey;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在运行此存储库中的代码并从 Book.API 生成错误,我收到如下错误页面:
请求 ID 为 |574e8e13-4e9d31fed64d4793。
当我查看文件中的日志条目时,我看到:
{
"Timestamp": "2021-01-25T18:07:24.6565993-06:00",
"Level": "Fatal",
"MessageTemplate": "BADNESS!!! Cannot open database \"Demo_EffectiveLogging\" requested by the login. The login failed.\r\nLogin failed for user 'TCA-PRECISION\\terry.aney'. -- {ErrorId}.",
"Exception": "System.Data.SqlClient.SqlException (0x80131904): Cannot open database \"Demo_EffectiveLogging\" requested by the login. The login failed.\r\nLogin failed for user 'TCA-PRECISION\\terry.aney'.\r\n at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken)\r\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, …
Run Code Online (Sandbox Code Playgroud) 我有一个文件夹纯粹是一个T4模板文件夹,但它将代码生成的文件输出到其他目录.所以我想忽略除*.tt文件之外的所有内容(即*.cs,*.master,*.resx等).有一个问题.我有一个名为static的子文件夹,其中包含永远不应忽略的文件.
/Test.tt
/Test.cs
/TestHtml.tt
/TestHtml.html
/Static
/Sub/Sub.cs
/Sub/Sub2/Sub2.cs
/Sub3/Sub4/Sub5/Sub5.html
Run Code Online (Sandbox Code Playgroud)
我只是想忽略/Test.cs和/Test.html但包括所有其他文件.我尝试过以下方法:
/.gitignore
# Ignore all
*
# But not these files...
!.gitignore
!*.tt
Run Code Online (Sandbox Code Playgroud)
/Static/.gitignore
!*.*
#also have just tried blank
Run Code Online (Sandbox Code Playgroud)
我不能让git忽略正确的事情......主要问题是我想要的"递归排除"静态/ ..
我对 git checkout 行为感到困惑。如果我想获取该文件的先前版本并执行以下操作:
git checkout HEAD^^ Xml/Config-Profile.xml
git status
Run Code Online (Sandbox Code Playgroud)
我得到:
On branch master
Your branch is up-to-date with 'origin/master'
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: Xml/Config-Profile.xml
Run Code Online (Sandbox Code Playgroud)
如果我这样做了,git diff,我没有区别。我发现如果我执行 git diff --cached,它会显示更改,所以我想这意味着我的 checkout 命令从存储库的 HEAD^^ 提交中提取并更新了“仅索引”?
我想我的担忧是(而且我无法直接从结帐手册页中获取信息):
1)为什么只有索引得到更新?为什么它不像我只是用文件的一些(以前的)副本替换了我的工作目录中的 Config-Profile.xml文件?
2)我想是什么让这让我感到困惑,也许这只是语义,是如果我在我的工作目录中编辑一个文件并决定我不喜欢它并做了一个 git checkout,它会替换文件工作目录。说完之后,我猜测 git checkout 会将索引中的最新文件拉入工作目录,而不是存储库中最新提交的文件?
3)是否有一个命令可以将文件从提交中直接拉到工作目录中,就好像我自己手动编辑到那个点一样?还是我需要创建自定义别名?
提前致谢。
我正在尝试实现一个类似于 Visual StudioGo To
成员搜索的自动完成/搜索框:
但是,我的bold
文本格式及其间距计算不正确。我将省略它的自动完成功能,只包含通过硬编码搜索词来格式化结果的代码。
由 确定的间距e.Graphics.MeasureString
似乎没有返回正确的值。我试图StringFormat.GenericTypographic
从这个问题中使用,我离得更近了,但仍然不正确。
这是我的下拉列表的显示,其中匹配的术语(以粗体显示)很容易表明我的格式位置计算已关闭(f
显然侵占了i
)。
除此之外,如果我将鼠标悬停在一个项目上,它会重绘我的文本而不加粗。我也想就此打住。
更新:我更改了我的代码以使用,TextRenderer
但现在看起来更糟。
现在我连接的每场比赛前后似乎都有额外的空间。
更新代码如下:
private void Form1_Load( object sender, EventArgs e )
{
var docGenFields = new[] {
new DocGenFieldItem { Display = $"Profile.date-birth.value", Value = "5/9/1973", FieldCode = $"Profile.date-birth.value" },
new DocGenFieldItem { Display = $"Profile.date-birth.text", Value = "Birth Date", FieldCode = $"Profile.date-birth.text" },
new DocGenFieldItem { Display = $"Profile.date-birth.raw-value", Value = …
Run Code Online (Sandbox Code Playgroud) 我正在开发 .NET 5 Web api,当我尝试返回 .NET 5 Web api 时,以下代码会引发错误NotFound()
。
[ApiController]
public class Download : ControllerBase
{
// Constructor and members omitted...
[HttpGet( Routes.KatApps.Download )]
[SwaggerOperation(
Summary = "Find and download KatApp kaml file based on precedence of folders passed in",
Description = "Find and download KatApp kaml file based on precedence of folders passed in",
OperationId = "KatApps." + nameof( Routes.KatApps.Download ),
Tags = new[] { "KatApps" } )]
[ProducesResponseType( StatusCodes.Status200OK )]
[ProducesResponseType( StatusCodes.Status304NotModified )]
[ProducesResponseType( typeof( …
Run Code Online (Sandbox Code Playgroud) 我试图为 WinForm 调用 ShowDialog(创建表单的实际代码位于 .linq 脚本中)并且一切正常,但对话框未在 LINQPad 应用程序中显示为中心。当多个显示器同时运行并且我盯着 LINQPad,运行我的脚本并在不同的显示器上弹出对话框时,这是有问题的。我假设将 IWin32Window 传递给 ShowDialog 将显示以所有者为中心的对话框,但我不知道如何从 LINQPad 获取 IWin32Window...这可能吗?
git ×4
c# ×3
.net-core ×2
asp.net-core ×2
ilogger ×2
.net ×1
asp.net ×1
combobox ×1
directory ×1
excel ×1
excel-vba ×1
git-checkout ×1
git-diff ×1
git-pull ×1
git-remote ×1
git-status ×1
graphics ×1
linqpad ×1
master-pages ×1
nested ×1
query-string ×1
razor-pages ×1
recursion ×1
repository ×1
vba ×1
winforms ×1
wsh ×1