This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static string uniqueCode() | |
| { | |
| string characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#"; | |
| string ticks = DateTime.UtcNow.Ticks.ToString(); | |
| var code = ""; | |
| for (var i = 0; i < characters.Length; i += 2) | |
| { | |
| if ((i + 2) <= ticks.Length) | |
| { | |
| var number = int.Parse(ticks.Substring(i, 2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public abstract class Enumeration : IComparable | |
| { | |
| private readonly int _value; | |
| private readonly string _displayName; | |
| protected Enumeration() | |
| { | |
| } | |
| protected Enumeration(int value, string displayName) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EntitytMap:ClassMap<Entity> | |
| { | |
| public EntitytMap() | |
| { | |
| Table("TableName"); | |
| Schema(Session.TenantName); | |
| Id(p => p.Id, "Id").GeneratedBy.Identity(); | |
| } | |
| } | |
| //If you want to have each tenant in their own schema, this should work. If you want to keep the schema the same but have a prefix on the table, you could change to: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public sealed class Singleton | |
| { | |
| Singleton() | |
| { | |
| } | |
| public static Singleton Instance | |
| { | |
| get | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IF(@@SERVERNAME = 'BS-DVP22\SQLEXPRESS') | |
| BEGIN | |
| USE [STD50_DEV_Sprint4]; | |
| declare @n char(1) | |
| set @n = char(10) | |
| declare @stmt nvarchar(max) | |
| -- procedures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USE master | |
| go | |
| DECLARE @dbname sysname | |
| SET @dbname = '<your database name>' | |
| DECLARE @spid int | |
| SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) | |
| WHILE @spid IS NOT NULL | |
| BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| With git log check which commit is one prior the merge. Then you can reset it using: | |
| git reset --hard commit_sha | |
| There's also another way | |
| git reset --hard HEAD~5 | |
| will get you back 5 commits. | |
| As @Velmont suggested below in his answer, in this direct case using: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @"^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*" + @"|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*""\x20*)*" + @"(?<angle><))?" + @"((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+" + @"|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*"")" + @"@" + @"(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}" + @"|\[" + @"(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}" + @"|[a-zA-Z\d\-]*[a-zA-Z\d]:" + @"((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)" + @"\])" + @"(?(angle)>)$"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) StartUp | |
| C:\windows\start menu\programs\startup | |
| * [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders] | |
| Startup="C:\windows\start menu\programs\startup" | |
| * [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders] | |
| Startup="C:\windows\start menu\programs\startup" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- check list files | |
| RESTORE FILELISTONLY | |
| FROM DISK = '<backup db file>.bak' | |
| -- Restore | |
| RESTORE DATABASE [<new db name>] | |
| FROM DISK = N'<backup db file>.bak' | |
| WITH FILE = 1, | |
| MOVE N'<DataLogicalName>' TO N'<new path>\<DB_data>.MDF', | |
| MOVE N'<LogLogicalName>' TO N'<new path>\<DB_log>.LDF', |