.net-3.5

Dapper and SQL Injections

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-28 03:46:34
问题 How does Dapper help protect against SQL injections? I am testing out different DAL technologies and have to choose one to be secure our site. I'm leaning towards Dapper (http://code.google.com/p/dapper-dot-net/), but need some help learning about security. 回答1: How does Dapper help protect against SQL injections? It makes it really, really easy to do fully parameterized data access, without ever needing to either concatenate input. In particular, because you don't need to jump through lots

See if user is part of Active Directory group in C# + Asp.net

家住魔仙堡 提交于 2019-12-28 02:24:05
问题 I need a way to see if a user is part of an active directory group from my .Net 3.5 asp.net c# application. I am using the standard ldap authentication example off of msdn but I don't really see how to check against a group. 回答1: With 3.5 and System.DirectoryServices.AccountManagement this is a bit cleaner: public List<string> GetGroupNames(string userName) { var pc = new PrincipalContext(ContextType.Domain); var src = UserPrincipal.FindByIdentity(pc, userName).GetGroups(pc); var result = new

Generic method with multiple constraints

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-27 13:10:10
问题 I have a generic method which has two generic parameters. I tried to compile the code below but it doesn't work. Is it a .NET limitation? Is it possible to have multiple constraints for different parameter? public TResponse Call<TResponse, TRequest>(TRequest request) where TRequest : MyClass, TResponse : MyOtherClass 回答1: It is possible to do this, you've just got the syntax slightly wrong. You need a where for each constraint rather than separating them with a comma: public TResponse Call

Generic method with multiple constraints

我们两清 提交于 2019-12-27 13:09:06
问题 I have a generic method which has two generic parameters. I tried to compile the code below but it doesn't work. Is it a .NET limitation? Is it possible to have multiple constraints for different parameter? public TResponse Call<TResponse, TRequest>(TRequest request) where TRequest : MyClass, TResponse : MyOtherClass 回答1: It is possible to do this, you've just got the syntax slightly wrong. You need a where for each constraint rather than separating them with a comma: public TResponse Call

LINQ: Dot Notation vs Query Expression

不问归期 提交于 2019-12-27 11:46:01
问题 I am beginning to use LINQ in general (so far toXML and toSQL). I've seen that sometimes there are two or more ways to achieve the same results. Take this simple example, as far as I understand both return exactly the same thing: SomeDataContext dc = new SomeDataContext(); var queue = from q in dc.SomeTable where q.SomeDate <= DateTime.Now && q.Locked != true orderby (q.Priority, q.TimeCreated) select q; var queue2 = dc.SomeTable .Where( q => q.SomeDate <= DateTime.Now && q.Locked != true )

File IO permission error while running EXE from LAN

蹲街弑〆低调 提交于 2019-12-25 18:39:01
问题 I am getting following error while running my .EXE file from network. I have developed application using .net framework 3.5. Help me remove this error, Please. Thnaks in advance... 回答1: Have you tried to give your application administrative rights? Here is how to do that: How to give my C# app administrative rights? manifest file 来源: https://stackoverflow.com/questions/15760814/file-io-permission-error-while-running-exe-from-lan

How to schedule a task using win32_schedule job class

喜夏-厌秋 提交于 2019-12-25 18:32:30
问题 I've to create a class which schedules a task to run at specified time. I know it can be achieved by win32_schedule class create method. Can someone please help me in creating a task which opens at a specified date and time?(Code Sample). Help me with the start time parameter(conversions and all) 回答1: It's not a code sample, but it can help you: http://social.msdn.microsoft.com/Forums/vstudio/en-US/022e4429-56bc-482c-9a67-af484d6978c1/using-windows-scheduled-tasks-in-c?forum=csharpgeneral 来源:

WPF: Bind property to TextBlock not working

只谈情不闲聊 提交于 2019-12-25 17:17:28
问题 I have below xaml file (this a piece): <Grid Opacity="1" Margin="5"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="ID"/> <Label Grid.Row="0" Grid.Column="1" Content="Name"/> <Label Grid.Row="0" Grid.Column="2" Content="Description"/>

IndexOutOfRangeException in VB.NET

99封情书 提交于 2019-12-25 17:06:12
问题 Picked up a legacy VB.NET project originally written for version 1.1 of the .NET framework. I'm running Vista with .NET 3.5. I have cleared out all the original error and the project will build; it just wont run. As far as I can tell, it is trying to run 'LoginForm' but putting breakpoints in doesn't work because the error is thrown before the breakpoints are reached, regardless of where in the file they are placed. Really can't work out what to do! Any help appreciated. StackTrace: System

Windows Aero Glass background is broken after hibernate. How can I solve this?

和自甴很熟 提交于 2019-12-25 13:14:14
问题 I am developing a program in C# .net 3.5 wpf. It has to work on windows xp, windows vista and windows 7. On the newer operation systems I wantet to create the background in Aero Glass. So this is only a special design. After hibernate, after suspending or after changing windows Desings to a basic design and back to aero all the added glass is displayed completely black. I display Glass via the GlassHelper Class (can be found with Google). Actually I see 3 ways to solve this problem. The first