我正在写一个bash脚本来做一些自动化.部分脚本涉及导航到本地存储,切换到本地主分支,然后拉远程主控以使用最新代码更新本地主分支.
有没有人知道我是否可以通过编程方式确定拉动是否导致合并冲突,以便我可以在那时保释而不执行脚本的其余部分?
任何帮助/信息表示赞赏,谢谢!
我在ASP.NET WebApi解决方案中使用Unity.WebApi NuGet包(Unity 4.0.1和Unity.WebApi 5.2.3).我面临的问题是,在尝试运行代码时,我收到错误:Make sure that the controller has a parameterless public constructor
.我在这里搜索过类似的帖子,但我找不到任何符合我问题的帖子.
请不要只说"添加无参数构造函数",因为它显示您显然不知道IoC是什么以及为什么该语句完全没有意义并且违背了IoC的目的.我之所以这么说是因为我在迄今为止看过的很多其他主题中看到了这一点.
这是我的Startup.cs(我使用的是Owin,所以我没有Global.asax):
public void Configuration(IAppBuilder app) {
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
// Registering unity stuff
UnityConfig.RegisterComponents();
app.UseWebApi(config);
}
Run Code Online (Sandbox Code Playgroud)
这是我的UnityConfig.cs:
public static class UnityConfig {
public static void RegisterComponents() {
var container = new UnityContainer();
// Register controller
container.RegisterType<MyController>();
// Register interface
container.RegisterType<IService, Service>();
GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的API控制器:
public class MyController : ApiController {
private IService service
public MyController(IService service) …
Run Code Online (Sandbox Code Playgroud) c# dependency-injection inversion-of-control unity-container asp.net-web-api
首先,这是一个编程任务,所以你知道.
无论如何,我想要做的是包括我写的共享库(来自前一个项目的链表)和我自己编写的shell.我发现的问题是,当我使用我的Makfile编译时,编译成功.然后当我尝试运行我的可执行文件时(让我们说它叫做prog),我得到以下内容:
[terminal]# ./prog
./prog: error while loading shared libraries: libmylib.so: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
以下是我的文件结构供参考:
include
|_
common.h
List.h
Node.h
lib
|_
libmylib.a
libmylib.so
libsrc
|_
Makefile // This makefile builds the library correctly and puts it in lib via 'make install'
List.c
List.h
Node.c
Node.h
common.h
Makefile
prog.c
Run Code Online (Sandbox Code Playgroud)
这是我的主要Makefile
CC=gcc
CFLAGS=-g -Wall -Llib
LIBS=-lreadline -lncurses -lmylib
PROGS=library prog
all: $(PROGS)
library:
cd libsrc; make install
prog: prog.o
$(CC) $(CFLAGS) -o $@ $< …
Run Code Online (Sandbox Code Playgroud)