dapper

Filling and binding two combobox WPF Caliburn.micro

China☆狼群 提交于 2019-12-05 09:16:46
I have this table: I use in my project this view Called NewItem and in this view there is two combobox. I would like to do this : that in the combobox Group there are all DESCRIPTION of table GROUP, and when i choose an item of this description (of first combobox) the second combobox fills of descriptions relating only to that description that I have chosen before. This is some code: XAML NewItemView: <ComboBox Height="21" HorizontalAlignment="Left" Margin="89,99,0,0" VerticalAlignment="Top" Width="106" x:Name="Group" SelectedItem="{Binding SelectedGroup}" /> The ViewModel code is like:

What exactly is the “information” that dapper caches?

删除回忆录丶 提交于 2019-12-05 08:16:54
On Dapper's documentation found here it states: " Limitations and caveats Dapper caches information about every query it runs , this allow it to materialize objects quickly and process parameters quickly. The current implementation caches this information in a ConcurrentDictionary object." What exactly does this mean? Ex: Is it caching returned data, or the query itself, or bits of both? It also says that " this [cached] data is never flushed ". How does this effect the "cached information" if the design schema of the table(s) you are querying is changed? As far as I know has each query you

Dapper Dynamic Parameters with Table Valued Parameters

旧时模样 提交于 2019-12-05 06:31:55
I was trying to create a generic method, which can read the parameters name and value from a class at Runtime and create parameter collection for Dapper query execution. Realized that till the point all parameters are Input type it works well, but if I have to add an Output / ReturnValue type parameters, then I need to work with DynamicParameters , else I cannot fetch the value of Output / ReturnValue parameters SP has following parameters: PersonList - TableValued - Input TestOutput - Int - Output I am not able to make following piece of code work: var dynamicParameters = new

Dapper & Oracle Clob type

ぃ、小莉子 提交于 2019-12-05 05:16:20
I am using dapper to do some oracle access. I have a scenario where I have to have an output parameter with a type of OracleDbType.Clob. As I am using dapper and thus using the base DbType enumeration I am using the DbType.Object enum as suggested here http://docs.oracle.com/html/B14164_01/featOraCommand.htm to stand in for OracleDbType.Clob. However, this sets the command parameter (deep down in dapper) to be of DbType object and oracle type Blob (as the DbConnection providers a concrete OracleParameter). The problem being this Oracle proc only works if this parameter is of type Clob not Blob

Is there a way of using MultiMapping and QueryMultiple together in Dapper?

本小妞迷上赌 提交于 2019-12-05 02:57:55
I have a few queries that I need to run together and I can do so using the QueryMultiple feature. But in this case I've not been able to find out how could I use MultiMapping . Does anyone know a way of achieving this? juharr I think this is what you're looking for though it's hard to tell without an example of the query you are trying to execute. var sql = @"Select * From Parent Left Join Child on Child.ParentID = Parent.ParentID Where Parent.ParentID = @id ... more queries"; using(var reader = connection.QueryMultiple(sql, new {id=selectedId})) { var stuff = reader.Read<Parent, Child, Parent

Mapping SqlGeography with Dapper

一个人想着一个人 提交于 2019-12-05 02:49:21
I have entity "Point", that contains Id, Text and geography coordinates. CREATE TABLE [Point] ( [Id] INT IDENTITY CONSTRAINT [PK_Point_Id] PRIMARY KEY, [Coords] GEOGRAPHY NOT NULL, [Text] NVARCHAR(32) NOT NULL, [CreationDate] DATETIME NOT NULL, [IsDeleted] BIT NOT NULL DEFAULT(0) ) CREATE PROCEDURE [InsertPoint] @text NVARCHAR(MAX), @coords GEOGRAPHY AS BEGIN INSERT INTO [Point](Text, Coords, CreationDate) VALUES(@text, @coords, GETUTCDATE()) SELECT * FROM [Point] WHERE [Id] = SCOPE_IDENTITY() END This is ts sql code of table and stored procedure of inserting. I have class for using dapper :

Mapping char(8) to string property with Dapper

限于喜欢 提交于 2019-12-05 02:45:36
I have the following table, abridged: CREATE TABLE [dbo].[TERMINAL] ( [TERM_CODEID] SMALLINT NOT NULL, [TERM_ACTIVE] SMALLINT NOT NULL, [TERM_NAME] VARCHAR (30) NOT NULL, [TERM_SLA] CHAR (8) NOT NULL, [TERM_SERIAL] VARCHAR (8) NULL, [TERM_VERSION] VARCHAR (8) NULL, [TERM_STATUS] INT NULL, ) When I try the following Dapper code - and I'm a complete Dapper novice, found it yesterday - I get an error: using (var conn = new SqlConnection("data source=ourServer; initial catalog=ourDb;user id=sa;password=ourPassword;")) { conn.Open(); var terms = conn.Query<Terminal>("select * from TERMINAL"); } The

Clarification of Dapper Example Code

馋奶兔 提交于 2019-12-05 01:47:07
I'm trying to grok Dapper and seem to be missing something very fundamental, can someone explain the following code taken from the Dapper home page on Google code and explain why there is no From clause, and the second param to the Query method (dynamic) is passed an anonymous type, I gather this is somehow setting up a command object, but would like an explanation in mere mortal terminology. Thank you, Stephen public class Dog { public int? Age { get; set; } public Guid Id { get; set; } public string Name { get; set; } public float? Weight { get; set; } public int IgnoredProperty { get {

Need Help in applying SOLID principles

陌路散爱 提交于 2019-12-05 01:09:40
问题 Really impressed with Juile Lerman's pluralsight course on "EF in Enterprise" and decided to build my demo app. I am using VS 2012 and latest versions of EF,SQL Server and MVC. I am building a demo application which applies SOLID principles. I am doing this to better understand how to implement DI & unit testing. I have used DB first approach for this demo application. It contains only one table named UserDetails and below is how it looks in SQL server. I will use this table for CRUD

How can I send a string as NULL to SQLServer using Dapper?

眉间皱痕 提交于 2019-12-04 23:54:46
I've got a scenario where a string in C# can be null . I need it to be NULL on SQLServer. I'm sending it to SQLServer using Dapper with a query like: connection.Query<MyObject>("[dbo].[sp_MyStoredProcedure]"), new { StartDate: startDate }, commandType: CommandType.StoredProcedure); Where startDate is the string that can sometimes be equal to null . The stored procedure's parameter is @StartDate varchar(10) = NULL When it's is NULL it returns all records. I've confirmed this behavior works via SSMS. I read this post by Marc Gravell that states: The null vs DBNull issue is a constant cause of