我坚持以下情况.我有一个数据库,其中包含一个包含客户数据的表格和一个表格,我在其中放置记录以监控B2B网站上发生的情况.
客户表如下:
监测表:
PARAMETER1中包含客户指南以及存储的其他数据类型.
现在问题是根据他们上次访问日期订购我们的客户,最近访问过的客户必须排在网格顶部.
我正在使用实体框架,我遇到了比较字符串和guid类型的问题,所以我决定在监控表之上创建一个视图:
SELECT
ID,
CONVERT(uniqueidentifier, parameter2) AS customerguid,
USERguid,
CreationDate
FROM
MONITORING
WHERE
(dbo.isuniqueidentifier(parameter2) = 1)
AND
(parameter1 LIKE 'Customers_%' OR parameter1 LIKE 'Customer_%')
Run Code Online (Sandbox Code Playgroud)
我在EF中导入了视图并进行了Linq查询.它什么也没有返回,所以我提取了生成的SQL查询.在SQL Management Studio中测试查询时出现以下错误: 从字符串转换为uniqueidentifier时转换失败.
问题在于以下代码段(针对此问题进行了简化,但也出现了错误:
SELECT *,
(
SELECT
[v_LastViewDateCustomer].[customerguid] AS [customerguid]
FROM [dbo].[v_LastViewDateCustomer] AS [v_LastViewDateCustomer]
WHERE c.GUID = [v_LastViewDateCustomer].[customerguid]
)
FROM CM_CUSTOMER c
Run Code Online (Sandbox Code Playgroud)
但是当我加入时,我得到了我的结果:
SELECT *
FROM CM_CUSTOMER c
LEFT JOIN
[v_LastViewDateCustomer] v
on c.GUID = v.customerguid
Run Code Online (Sandbox Code Playgroud)
我试图制作一个SQL小提琴,但它正在该网站上工作.http://sqlfiddle.com/#!3/66d68/3
谁可以指出我正确的方向?
我有一个字符串数组,如果在插入它们之前存在于表中则需要进行检查,以避免重复.什么是SQL查询以及如何将以下值替换为它?:)
ArrayList<Product> NewProducts= new ArrayList<Product>();
Run Code Online (Sandbox Code Playgroud)
我的产品型号:
public class Product {
public Product()
{
}
public String PID = "pid";
public String getPID() {
return PID;
}
public void setPID(String pID) {
PID = pID;
}
public String getNAME() {
return NAME;
}
public void setNAME(String nAME) {
NAME = nAME;
}
public String PID = "pid";
public String NAME = "name";
}
Run Code Online (Sandbox Code Playgroud)
表名: product_pics
数据库名称: product_db
我知道这句话会有效:
"SELECT * FROM ' + product_pics + ' WHERE PID=' + pid +'" …Run Code Online (Sandbox Code Playgroud) 我正在开发一个处理电子邮件的小型本地 c# 应用程序。我正在使用 S22/Imap 下载并分离标头。当我尝试获取电子邮件的日期时,它会返回字符串版本,如 MIME 标头中所示。
\n\n对于大多数日期,DateTime.TryParse 运行良好,但对于某些日期,它会失败。以下是每个示例的示例,我在 RFC 中找不到如何处理它们:
\n\n我有一台具有8GB RAM的生产服务器。我希望在服务器上托管elastic,logstash和kibana。使用docker compose
每个容器的Java大小建议的内存大小是多少?我该如何配置。
我的docker-compose样子如下
---
version: '3'
services
kibana:
build:
context: kibana/
container_name: kibana
volumes:
- ./kibana/config/:/usr/share/kibana/config:ro
networks: ['elk']
depends_on:
- elasticsearch
restart: always
elasticsearch:
build:
context: elasticsearch/
container_name: elasticsearch
networks: ['elk']
volumes:
- ./elastic-data:/usr/share/elasticsearch/data
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
restart: always
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
environment:
- cluster.name=es-docker
- node.name=node1
- bootstrap.memory_lock=true
logstash:
build:
context: logstash/
container_name: logstash
volumes:
- ./logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro
networks: ['elk']
ports:
- "5044:5044"
depends_on:
- elasticsearch
restart: always
networks: …Run Code Online (Sandbox Code Playgroud) production-environment elasticsearch docker-compose elastic-stack
这个奇怪的错误是在发布这篇文章的前一天出现的。以前它工作正常,但现在不行了。
在重新启动系统的一个动作中,错误消失并能够访问应用程序。
再次重新启动系统后,错误开始出现而不知道根本原因。
启用的协议: net.tcp,http
我可以浏览以下链接
这是导致异常的以下代码段
objCheckUserLoginResponse = AuthenticationManagerClient.Check(objCheckUserLoginRequest, objCustomer);
Run Code Online (Sandbox Code Playgroud)
例外:
The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/TAServices/AuthenticationManager.svc' is unavailable for the protocol of the address.
System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/TAServices/AuthenticationManager.svc' is unavailable for the protocol of the address.
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.StreamedFramingRequestChannel.SendPreamble(IConnection connection, TimeoutHelper& timeoutHelper, ClientFramingDecoder …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 blazor 网页中设置实时日期时间。我尝试使用 Datetime.now 。它没有更新实时时间。我想在不使用 javascript 的情况下做到这一点。
关于这个问题有什么帮助吗?
将datacontext设置为属性是否存在任何潜在问题:
知识库
public Repository()
{
public DataContext dc {get;set;}
public GetOrders(int id)
{ ...from dc.Orders...}
}
Run Code Online (Sandbox Code Playgroud)
服务层:
public GetNewOrders()
{
....
Repository rep=new Repository();
using {DataContext dc=new DataContext())
{
rep.dc=dc;
rep.GetOrders(id);
}
}
Run Code Online (Sandbox Code Playgroud) 大家好.我使用存储库和服务模型遇到了一种奇怪的设计模式.ASP.NET MVC,WCF和一些Windows服务的应用程序组成部分.我的存储库正在使用LINQ DataContext.随着我的应用程序的发展,我发现自己在任何地方都传递了对IWhateverService服务的引用.例如,我有IAccountService,它定义了ChangePlan(帐户帐户,计划计划)等方法.
现在,似乎IAccountService是放置此方法的最佳位置,因为我们在此处为帐户提供服务.但是,ChangePlan方法在实际更改计划之前需要了解一些事情.它必须知道用户的当前使用情况,可用计划列表,用于计费的电子商务服务界面的实例等.
我认为让ChangePlan方法接受IAccountService接口中的所有必需服务.但是这些其他服务的要求是实现的问题,不应该是接口定义的一部分.
所以现在我发现自己为AccountService创建了一个巨大的构造函数,它采用了IAccountRepository,IPlanService,IUsageService,IEcommerceService和IValidationDictionary的实例.这根本感觉不对.
现在采取这种情况.显然,IAccountService包含一个通过ID检索用户帐户的简单方法:Account Get(int id)有几次我只需要调用此方法.所以,我去创建我的AccountService,它想要所有这些其他服务的实例(特别是IValidationDictionary,我不需要验证).再次,这感觉不对.我可以传递null,但这只是因为我知道实现不会将它们用于此方法.
另外,为了避免在我需要的地方实例化服务,我创建了一个名为ServiceFactory的静态类,它有静态方法,CreateAccountService,CreatePlanService等......我在应用程序周围调用这些方法.似乎没问题,但我不能动摇这种不合适的感觉.
我的断开在哪里?有人有什么建议吗?
谢谢.
安德鲁
给定:我在页面加载时加载了一个消息队列.
使用jGrowl,我如何以类似滴水的方式一次显示每条消息,一条消息?
考虑一个典型的NHibernate上下文类.
public class SampleContext : NHibernateContext
{
public SampleContext(ISession session)
: base(session)
{ }
public IQueryable<Person> People
{
get { return Session.Linq<Person>(); }
}
public Person GetPerson(int id)
{
get { return Session.Linq<Person>().SingleOrDefault(p => p.ID == id); }
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题:
- 我怎样才能重写GetPerson方法来忽略缓存并直接从数据库中检索数据?
c# ×3
sql ×2
android ×1
asp.net ×1
asp.net-mvc ×1
caching ×1
datacontext ×1
datetime ×1
email ×1
endpoint ×1
iis ×1
java ×1
jgrowl ×1
jquery ×1
live-update ×1
messaging ×1
mime ×1
net.tcp ×1
nhibernate ×1
service ×1
sql-server ×1
sqlite ×1
wcf ×1