我的服务接口有一个名称空间 Services.Interfaces
Service Interfaces的实现具有名称空间 Web.UI.Services
例如,我有2个服务实现
这就是我目前使用SimpleInjector注册这些服务的方法.
container.Register<IUserService, UserService> ();
container.Register<ICountryService, CountryService> ();
Run Code Online (Sandbox Code Playgroud)
问题:如果我有超过100个服务夸大了一点.我需要为每项服务添加一行.
如何使用Simple Injector将所有实现从一个程序集注册到所有接口形成另一个程序集?
c# asp.net-mvc ioc-container inversion-of-control simple-injector
为什么需要抢先认证?
System.setProperty("httpclient.authentication.preemptive", "true");
我用java编写了Web服务访问客户端程序。我们在 call 对象中设置用户名和密码的地方,它工作得很好。
最近,我们的服务提供商在他们身边进行了一些更改,之后他们在网络服务调用中没有收到用户名和密码,并且由于他们没有收到用户名和密码,因此我们无法连接到他们的(提供商)服务。
然后我用谷歌搜索并发现了抢占式身份验证。在调用 Web 服务时,我们将 "httpclient.authentication.preemptive" 设置为 "true" - System.setProperty("httpclient.authentication.preemptive", "true"); ,然后我们就可以从我们的服务提供商那里收到回复。
当我们删除 System.setProperty("httpclient.authentication.preemptive", "true"); 线然后我们无法连接到他们的服务。
我本周安装了Visual Studio 2015.但是我发现我的Razor Views中没有intellisense.
在Visual Studio 2013中它运行良好.
我的所有css文件都在~/Content/css/(*.min.css)下,包括bootstrap.
这是捆绑配置:
bundles.Add(new StyleBundle("~/Content/smartadmin").IncludeDirectory("~/Content/css", "*.min.css"));
Run Code Online (Sandbox Code Playgroud)
当我尝试在剃刀视图中使用一些引导程序css时,自动完成框中不会弹出任何内容.右边的引导类旁边应该有一个紫色图标..?没有列出图标,也没有列出引导程序包下可用的css类.
我做了一个完整性检查并创建了一个新的MVC 5应用程序.这附带了bootstrap.这是有效的,所有的intellisense都在那里.
我该如何解决这个问题?当然,我的解决方案一定是问题吗?它不喜欢css文件在内容下的子文件夹下吗?
更新:所以我复制了文件的未分类版本,然后它被拿起来了.所以任何人都知道为什么VS没有为intellisense选择缩小的文件?
我对应用程序服务的理解是它们在域和用户界面之间进行链接.换句话说,它们为控制器提供服务以在域上执行操作.
我的应用程序中有以下项目布局:
我Service Interfaces在Web UI项目之外的谎言.然后在Web UIProject中我实现了服务接口Services.
然而,当我们将其付诸实践时,这种结构有点瑕疵并产生循环依赖.我试图在这个链接中遵循架构.https://www.develop.com/onionarchitecture
对于给定的服务,我想传入视图模型,基于视图模型对域执行操作,然后返回更新的视图模型.这种方法有误吗?
我的理解是否正确,应用程序服务本质上将视图模型作为参数,更新域中的一些细节并在需要时查看模型然后返回视图模型?
要么
应用程序服务是否仅将c#数据类型和域模型作为参数处理并返回相同的数据类型?换句话说,在视图模型中不获取或设置任何信息.实际上并不知道视图模型的存在.
我只需要澄清一下严格DDD方法的最佳方法.
architecture domain-driven-design onion-architecture ddd-service
小问题,当我在 Windows 计算机上运行 ServiceStack API 应用程序时,命名空间按照我的说明正确显示。但是当我在 Linux 机器上运行 mod_mono 服务时。然后这些命名空间就会被其他东西覆盖。请参阅下面我的代码:
数据传输组织
namespace API_ESERVICES_NOTIFICATION
{
[DataContract(Namespace = "urn:com.example:service:20130308")]
public class GetAccountNotification
{
[DataMember]
public GetAccountResponseTO getAccountResponse {
get;
set;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Windows 生成的 SOAP11 xml
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetAccountNotification xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com.example:service:20130308">
<getAccountResponse xmlns:d2p1="urn:com.example:service:entity:20130308">
Run Code Online (Sandbox Code Playgroud)
Linux Mod_Mono
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetAccountNotification xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION">
<getAccountResponse xmlns:d2p1="http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION.Model">
Run Code Online (Sandbox Code Playgroud)
现在我如何将 Linux 命名空间设置为 urn:com.example:service:entity:20130308 和 urn:com.example:service:20130308,而不是http://schemas.datacontract.org/2004/07/API_ESERVICES_NOTIFICATION。模型。任何帮助将不胜感激。
我有一个Textbox添加到.ascx控制页面如下:
<asp:TextBox id="txtDescription" runat="server" Width="500" TextMode="MultiLine" Rows="2"></asp:TextBox>
Run Code Online (Sandbox Code Playgroud)
并且它会在首次加载时显示类似的内容(包括开头的4个空格):
Description goes here
Run Code Online (Sandbox Code Playgroud)
简而言之,这是一个Multiline Textbox2行.但是,无论何时我们Postback对服务器执行操作,当页面重新加载时,我们都会得到:
Description goes here
Run Code Online (Sandbox Code Playgroud)
另一个Postback.
Description goes here
Run Code Online (Sandbox Code Playgroud)
等等.基本上,每次在a之后刷新页面时Postback,它会在文本框的开头添加4个空格.在某些页面上,这不是问题,但是,如果用户将Gridview一些数据输入到一个或其他一些数据中Control,那么Textbox最终可能会将20个左右的字符分流到右边,有时会超出界限的Textbox.
简而言之,这对我们公司来说是一个问题,因为它发生在我们所有的网页上.我们的一位客户多次通过"......你能在某些时候对文本框开头的空间做些什么吗?"
现在,我们使用的临时修复是我们PageLoad函数中的以下代码,但是,我们仍然在开头留下了4个空格Textbox.并且在100个.ascx和.aspx控件/页面中滚动它并不是真正的解决方案.
if (IsPostBack)
txtDescription.Text = txtDescription.Text;
Run Code Online (Sandbox Code Playgroud)
现在最大的问题是,有没有人知道如何删除这些神秘的4个空间,这些空间一直被添加到一个开头Multiline Textbox?
我有一个具有以下布局的应用程序.在共享视图文件夹中,我有_Layout.cshtml,_SideNav.cshtml和_CurrentUser.cshtml.
在_Layout.cshtml我有:
@{ Html.RenderPartialIf("_SideNav", Request.IsAuthenticated); }
Run Code Online (Sandbox Code Playgroud)
在_SideNav.cshtml我有:
@{ Html.RenderPartial("_CurrentUser"); }
Run Code Online (Sandbox Code Playgroud)
在_CurrentUser.cshtml我有:
<div class="login-info">
<span>
<a href="javascript:void(0);" id="show-shortcut" data-action="toggleShortcut">
<img src="~/content/img/avatars/sunny.png" alt="me" class="online" />
<span>@User.Identity.Name</span>
<i class="fa fa-angle-down"></i>
</a>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我们FormsAuthentication用来验证用户.我们没有使用Identity随附的标准身份验证,ASP.Net MVC 5因为我们使用的是LDAP服务器.
FormsAuthentication.SetAuthCookie(username, isPersistent);
.....
HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(username, "Forms"), roles);
Run Code Online (Sandbox Code Playgroud)
我们username在cookie中使用,以便我们可以轻松地从LDAP服务器获取信息.
问题:@User.Identity.Name返回该用户名.但我需要显示用户的全名.我们在进行身份验证时可以访问全名.但不知道如何使用它.
如何将FullName值传递AccountController给_CurrentUser.cshtml局部视图?有点像全球容器,@User.Identity有更多属性可以设置.
我收到此错误:
解析XML时出错:标记不匹配.
如果有人知道如何解决这个问题,请你告诉我我缺少的东西,谢谢.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/android" >
<Button
android:id="@+id/btnChangeImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change Image" >
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 假设我有一个客户类型,并且我想为所有客户存储某些信息.但是,客户可以是个人和组织.在每种情况下,我都希望在它们上存储不同类型的信息,并且能够以不同的方式对它们进行操作.
我通常只想处理Customer对象,但在某些时候根据情况处理更具体的类型(例如,在创建地址时我想使用Person的Surname和GivenNames,但是TradingName (但它没有填充OrgName,而不是组织).
我对如何处理这个问题感到很沮丧.我在搜索时发现的示例/问题假设更具体的类型具有相同的属性/方法,因此可以进行一般处理.
我只有一个字段用于我的Customer对象中的任何一个类型,还有一个标志来指示哪个具有值(即isPerson())并在我需要时在我的代码中检查.我是否使用继承,何时需要使用IsType()类型的逻辑?或者是否有一些我缺少的设计模式可以帮助这种类型的场景?
我们正在尝试将ServiceStack与我们的ASP.NET MVC 5应用程序一起使用.
因此最终用户将使用充分利用的Web应用程序ASP.NET MVC.
我们想要发布一组API,以便我们的旧系统可以与新系统通信.
新系统利用SimpleInjector IoC将整个应用程序粘合在一起.
我已安装ServiceStack.Mvc但无法让它工作.
我尝试过以下链接:https://github.com/ServiceStack/ServiceStack/wiki/Mvc-integration
我认为这是因为ServiceStack它内置了IoC与之相冲突的内容SimpleInjector.
这是我的 Application_Start
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Bootstrap.Configure();
#region Initialize SimpleInjector
var container = new Container();
InitializeContainer(container);
container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
container.RegisterMvcIntegratedFilterProvider();
container.Verify();
DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
#endregion
new AppHost().Init();
}
Run Code Online (Sandbox Code Playgroud)
这是我的 AppHost
public class AppHost : AppHostBase
{
public AppHost() : base("MVC 5", typeof(MyServices).Assembly) { }
public override void Configure(Container container)
{
SetConfig(new …Run Code Online (Sandbox Code Playgroud) asp.net-mvc web-services ioc-container servicestack simple-injector
我有以下Onion Architecture框架.
Domain
Entities - 对于我的域名实体Interfaces - 对于我的域界面Services - 对于我的域名服务Infrastructure
Data- Fluent NHibernate坚持不懈Interfaces - 用于基础设施接口Logging - 只是一个登录界面,以防我想将我的日志库切换到其他东西.Dependency Resolution- 我的大多数IoC注册都在这里.Services
Interfaces- 应用程序服务接口进入这里,它们将在UI项目中实现.Tests
Infrastructure Tests - 用于测试基础设施服务等Domain Tests - 用于测试域模型和服务Web
UI - 用户界面项目,我实现应用程序服务,用户界面等...随着Domain Driven Development一会识别Bounded Contexts.互联网上的大多数文献都指出,每个文献都Bounded Context需要抽象到自己的项目或命名空间中.
Domain Models在一个项目中拥有所有项目而Domain Services在另一个项 在不同的命名空间或项目中没有不同的有界上下文真的很重要吗?Model A是my Bounded Context A,但是 Bounded Context …c# architecture design-patterns domain-driven-design onion-architecture
完全按照示例中的说明实施Kendo Grid。
这是示例中的寻呼机:

这是我的传呼机:

注意箭头如何位于按钮顶部。

为什么会这样呢?我以为如果您安装KendoUI,一切都应该开箱即用?
我已经在Chrome,Firefox和IE中尝试过此方法,并且结果相同。
有谁知道如何解决这一问题?
最糟糕的部分是右侧的刷新,它与旁边的物品数量完全不一致。
我什至尝试过在新解决方案上进行全新安装,但也没有解决问题。
有人可以帮帮我吗?也许还有更多步骤可以正确安装Kendo UI?
c# ×6
asp.net-mvc ×3
architecture ×2
asp.net ×2
mono ×2
razor ×2
servicestack ×2
web-services ×2
css ×1
ddd-service ×1
http-headers ×1
httprequest ×1
java ×1
kendo-grid ×1
kendo-ui ×1
namespaces ×1
oop ×1
preemptive ×1
smartadmin ×1
telerik ×1
xml ×1
xml-parsing ×1