var items = db.Mods.Where(m=>m.SomeField==model.SomeField);
var itemId = db.Mods.FirstOrDefault(m=>m.SomeField==model.SomeField).Select(m=>m.Id);
var itemId = db.Mods.Single(m=>m.SomeField==model.SomeField).Select(m=>m.Id);
/* параметры */
CREATE TABLE Parameters (Id INT NOT NULL PRIMARY KEY, Name NVARCHAR(150) NOT NULL)
/* возможные значения параметров */
CREATE TABLE ParametersOptions (Id INT NOT NULL PRIMARY KEY, ParameterId INT NOT NULL, Value NULL NVARCHAR(150))
/* привязка конкретному товару определенного значения параметра */
CREATE TABLE ParametersValues(Id INT NOT NULL PRIMARY KEY,ProductId INT NOT NULL, ParameterId INT NOT NULL, Value INT NOT NULL)
<customErrors mode="RemoteOnly" defaultRedirect="~/errors/error.aspx">
<error statusCode="500" redirect="~/errors/error500.aspx" redirectMode="ResponseRewrite" />/>
</customErrors>
<asp:Label runat="server" ID="ErrorMessage"></asp:Label>
protected void Page_Load(object sender, EventArgs e)
{
var error = HttpContext.Current.Server.GetLastError();
this.ErrorMessage = error.Message;
}
httpBinding.Security.Message.ClientCredentialType=BasicHttpMessageCredentialType.Certificate;
serviceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode=X509CertificateValidationMode.Custom;
serviceHost.Credentials.ClientCertificate.Authentication.CustomCertificateValidator = new CertValidator();
public class MyService{
public IEnuberable<SVisit > GetAllVisitors(){
return dc.Visits.ToList().Select(Mapper.Map<SVisit>);
}
}
public class Payment
{
[Key]
public int doc_number{ get; set; }
public int? parrent_doc_number{ get; set; }
public virtual Payment parrent { get; set; }
или
public virtual Payment parrent_ { get; set; }
public virtual ICollection ChildPayments { get; set; }
}
public static class Helper{
public static int? GetWorkingTime(this MyContext context){
var query = (from e in context.events
join a in context.actions on e.CurrEventID equals a.CurrEventID into es
from p in es.DefaultIfEmpty()
select new { UnitDate = e.ActionDate, UnitId = e.CurrEventID, HeaderID = p.HeaderID, IsDone = p.MarkerOn, Begin = e.BeginTime, End = e.EndTime })
.Where(w => w.HeaderID == this.HeaderID)
.Where(w => w.IsDone == true && w.Begin<w.UnitDate && w.UnitDate<w.End )
.Distinct()
.Select(s => DbFunctions.DiffMinutes(s.Begin, s.End)).Sum();
return query ?? 0;
}
}