dto

Restful : multiple cases for a same ressource (same api end point ?)

拈花ヽ惹草 提交于 2019-12-11 15:32:11
问题 For example, i have two scenarios for creating a user : Created by administrator, without password. The user will have to choose it on activation page. Created by the user himself, with password. The activation page won't show password inputs because the password already exists. The thing is it's the same resource, a user. But depending on who (where) the api is called, the expected behaviour is different. In one case the DTO should contains the password posted by the user, in the other case

C# DTO with read only property

一世执手 提交于 2019-12-11 13:54:46
问题 I have the following class: [DataContract()] public partial class User { [DataMember()] public int Id { get; set; } [DataMember()] public string Name { get; set; } [DataMember()] public string Surname { get; set; } } My DTO classes are in one assembly and my model (EF) is in another. Therefore all properties must be public get/set. The Id is an identity column and is set by the db and also automapped. However I don't want that the user changes the id. Is it possible to set an attribute on the

ServiceStack ORMLite - How to Select All to match the request DTO's properties automatically

↘锁芯ラ 提交于 2019-12-11 13:54:35
问题 I have several ServiceStack ORMLite POCO, one is Company below. public class Company { [AutoIncrement] public int id { get; set; } public string company { get; set; } public int? companyNo { get; set; } public bool? active { get; set; } } If two properties are valid in the following request: req.company="ABC Company", req.active=ture, and all other properties are null. Then it can return all records matching the two properties. The code may look like below: public object Get(Company req) {

Nested Lists and Automapper.Map

和自甴很熟 提交于 2019-12-11 12:15:57
问题 So I have 2 objects,AlbumDto and AlbumMediaDto. public class AlbumDto { public int AlbumId { get; set; } public string Title { get; set; } public DateTimeOffset? AlbumDate { get; set; } public AlbumMediasDto Media { get; set; }// list of media } And I have a method from the repo that would return a list of albums (where each has the properties mentioned above which includes a list of media) var albumsForChild = await GetTenantRepository<IAlbumRepository>().GetAlbumsForChild(childId); So I'm

DataStructure for the DataTable server side processing

◇◆丶佛笑我妖孽 提交于 2019-12-11 10:28:57
问题 I am using DataTables 1.10 with Spring MVC. When using server side processing it send set of parameters to the controller. It is set of two dimention array but the column being the string like this: columns[0][data]= columns[0][name]= columns[0][orderable]=false columns[0][search][regex]=false columns[0][search][value]= columns[0][searchable]=true columns[1][data]= columns[1][name]= columns[1][orderable]=false columns[1][search][regex]=false columns[1][search][value]= columns[1][searchable]

How is called DTO class that also access db?

狂风中的少年 提交于 2019-12-11 08:25:14
问题 The definition of DTO from Wikipedia is the following: Data transfer object (DTO) is an object that carries data between processes. The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behavior except for storage and retrieval of its own data (accessors and mutators). DTOs are simple objects that should not contain any business logic that would require testing. If, instead, the class containing the Data is not used for data

DTOs in WCF RIA Services Master-Detail

落花浮王杯 提交于 2019-12-11 07:43:39
问题 I have to make a Master-Detail scenario where in the master I can show many types of items, that they all implement IDto : interface IDto { int Id { get; set; } string Title { get; set; } EntityType { get; set; } enum EntityType { Contact, Person, Company, Customer Employee, Vendor, Job } Note: I am using Entity Framework EDM (generated ObjectContext and EntityObject s). The class hierarchy is that Contact is the subclass for Person and Company , Person is the baseclass of Employee , Company

automapper unflatten excludes value from parent object

試著忘記壹切 提交于 2019-12-11 07:06:24
问题 I've a situation where entity framework core (2.0) is performing additional work to a parent table when I update a row in a child table. I've pin-pointed the cause to a value not being set in the unflattened object tree produced by AutoMapper (I'm not saying it is an error in AutoMapper; it's probably more to do with my code). I'm using ASP.NET Core 2.0, C#, EF Core 2.0 and AutoMapper for the API development side. The database already exists and the EF classes scaffolded from it. To keep it

good way to represent a excel sheet value in Java

被刻印的时光 ゝ 提交于 2019-12-11 06:05:22
问题 Consider that I've a excel sheet in below format: person age Foo 29 Bar 27 Now I want to read these values (using POI HSSF) and have to process them. What's the best way to do that? Note that I do not have a Object Person in my application, becasue the values that may come in excel sheet is arbitrary (i.e. it may not be the person name and age). So, I need to use some kinda HashMap to store these values. In case multiple rows, is it good to have a List !? 回答1: public class Grid { private Row

The entity or complex type 'FPSDB_newModel.Form_Attachment' cannot be constructed in a LINQ to Entities query

邮差的信 提交于 2019-12-11 05:01:25
问题 I am using Entity Framework DB first approach. When I want to pull the data from DB I use the method GetForm_AttachmentByAppID .I get the following run time error when I call this method from my code: An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code Additional information: The entity or complex type 'FPSDB_newModel.Form_Attachment' cannot be constructed in a LINQ to Entities query. public partial class Form