poco

Entity Framework 4.1 Code First Foreign Key Id's

断了今生、忘了曾经 提交于 2019-12-02 16:46:36
I have two entities referenced one to many. When entity framework created the table it creates two foreign keys, one for the key I have specified with the fluent interface and the other for the ICollection. How do I get rid of the duplicate foreign key? public class Person { public long RecordId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Username { get; set; } public long DepartmentId { get; set; } public virtual Department Department { get; set; } } public class Department { public long RecordId {

POCO's, DTO's, DLL's and Anaemic Domain Models

爱⌒轻易说出口 提交于 2019-12-02 15:38:42
I was looking at the differences between POCO and DTO (It appears that POCO's are dto's with behaviour (methods?))and came across this article by Martin Fowler on the anaemic domain model. Through lack of understanding, I think I have created one of these anaemic domain models. In one of my applications I have my business domain entities defined in a 'dto' dll. They have a lot of properties with getter's and setter's and not much else. My business logic code (populate, calculate) is in another 'bll' dll, and my data access code is in a 'dal' dll. 'Best practice' I thought. So typically I

DDD using STE vs POCO

烈酒焚心 提交于 2019-12-02 10:57:42
Developing n-layered application with DDD (o better DDDD because we are using WCF) using Microsoft technology (where we have full controll of all component), the best choise seems to be STE vs POCO (this last one force the usage of DTOs). That's right? In your opinion make sense the usage of STE with DTOs where we need them? Thanks. I really can recommend Julie Lerman's Programming Entity Framework . She goes in depth about simple poco's, dto's and Self Tracking Entities. Advantages and disadvantages are described. But off course depending a lot on application requirements and personal taste.

Upload a file using POCO - SSL Connection Unexpectedly Closed Exception

南楼画角 提交于 2019-12-02 09:01:19
Upload a file to a HTTPS url using POCO HTTP POST request always returns "SSL Connection Unexpectedly Closed" Exception Below is the code i am using for Multipart upload of a file.. try { Poco::URI uri(uploadLink); const Poco::Net::Context::Ptr context = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, "", "", "", Poco::Net::Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort(), context); session.setKeepAlive(true); // prepare path std::string path(uri.getPathAndQuery()); if (path.empty()) { path = "/"; }

Add to Existing Model based on a POCO with need to add to List<T>

强颜欢笑 提交于 2019-12-02 04:29:35
I have a poco model that looks like this: public int Id {get; set; public string EmailAddress { get; set; } public int? GenderTypeId { get; set; } public List<FindPersonResultsViewModel> findPersonResultsViewModel { get; set; } The List FindPersonResultsViewModel contains public string FirstName { get; set; } public string LastName { get; set; } At first on a Post I have the following data public IActionResult FindPerson (FindPersonViewModel findPersonViewModel) Id : 4432 EmailAddress: "johnsmith@test.com" findPersonResultsViewModel : null So what I want to do is hydrate this list view model

How does MS Entity Framework map from the conceptual model to CLR types?

泪湿孤枕 提交于 2019-12-02 04:28:33
问题 Given an Entity Data Model (EDMX) with "Code Generation Strategy" set to "None", how does EF determine which CLR types to map the conceptual model to? I think I read somewhere that it just probes the assembly for types that match the conceptual model, but that was in reference to a CTP edition of EF. Is this still the case? Can I control this process somehow? In particular, I am in a scenario where I am moving a substantial codebase from using Linq2SQL to using POCO with EF 4.0. Thus, I have

Entity Framework 5.0 composite foreign key to non primary key - is it possible?

烈酒焚心 提交于 2019-12-02 04:17:13
问题 I am using Entity Framework 5.0.0.0 in a .net 4.5 console application and I have to access a database with two tables in it with a foreign key relationship between them like so: The odd thing about it is that the foreign key is between B(Almost1, Almost2) and A(Almost1, Almost2) not from B(AId) to A(AId) . This is allowed by SQL server as Almost1 and Almost2 combined are unique and neither are nullable (on table A at least - on B they are as it is an optional relationship but that is by the

Programmatically obtain Foreign keys between POCOs in Entity Framework 6

[亡魂溺海] 提交于 2019-12-02 03:02:57
问题 I am faced with an EF6 Code First context, with a few DbSet s of POCOs that have navigation properties (and foreign keys) between them, e.g.: public partial class Person { public Guid Id { get; set; } public virtual ICollection<Address> Address { get; set; } } public partial class Address { public Guid Id { get; set; } public Guid FK_PersonId { get; set; } public virtual Person Person { get; set; } } modelBuilder.Entity<Person>() .HasMany (e => e.Address) .WithRequired (e => e.Person)

Entity Framework 5.0 composite foreign key to non primary key - is it possible?

雨燕双飞 提交于 2019-12-02 01:32:41
I am using Entity Framework 5.0.0.0 in a .net 4.5 console application and I have to access a database with two tables in it with a foreign key relationship between them like so: The odd thing about it is that the foreign key is between B(Almost1, Almost2) and A(Almost1, Almost2) not from B(AId) to A(AId) . This is allowed by SQL server as Almost1 and Almost2 combined are unique and neither are nullable (on table A at least - on B they are as it is an optional relationship but that is by the by). Here's some SQL for creating this situation: CREATE TABLE [dbo].[A]( [AId] [int] IDENTITY(1,1) NOT

How does MS Entity Framework map from the conceptual model to CLR types?

亡梦爱人 提交于 2019-12-02 01:32:13
Given an Entity Data Model (EDMX) with "Code Generation Strategy" set to "None", how does EF determine which CLR types to map the conceptual model to? I think I read somewhere that it just probes the assembly for types that match the conceptual model, but that was in reference to a CTP edition of EF. Is this still the case? Can I control this process somehow? In particular, I am in a scenario where I am moving a substantial codebase from using Linq2SQL to using POCO with EF 4.0. Thus, I have the Linq2SQL classes as well as my POCO classes, for now residing in the same assembly, but in