-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial checkin for Reverse Engineering #1601
Changes from all commits
2531c3d
a8da7f3
7e76737
c57e3df
6aef649
17c8e86
54511ed
d33887e
51736f6
97bfa12
867e409
6795dcf
df4644b
810ed44
33ecab7
7c3724a
f4ba3ae
4c62c99
7d0cc67
4c52ed8
650fe8e
30dfccd
2de4254
2a4e54a
2812cb1
fd770be
56baa23
e527cec
2b73e16
6a792eb
2b716bc
b4454ca
cff5c79
afadd59
c373083
42d6fe5
f9f5824
48630f6
dc336cd
2a37cdb
4ce5f95
41c885e
7743b40
06d1aae
96016e8
d9d71ef
bb11415
c45fb0c
88cfe04
6acfd7d
1b722b4
53967d9
5c76f38
3c1f1e4
923113b
7ac0952
f698fda
cb5a6f2
9970516
101cf97
5fde765
bd5672f
cdb6ee4
0af2fec
4a17eba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
|
||
namespace Microsoft.Data.Entity.Commands.Utilities | ||
{ | ||
public class ServiceProvider : IServiceProvider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can DesignTimeServices be reused instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. I'll look into it. They work slightly differently - this one would use the "design-time" services first and only use the "runtime" services if it can't find the service there. That allows you to override if that's what you want (this was taken from a similar class in Scaffolding). Plus the list of services in DesignTimeServices is hard-coded. But I don't currently use the override functionality and I could hard-code the ILogger service. I won't block on this if that's OK? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. DesignTimeServices is designed the other way around--let the user optionally override design-time services. We may need mechanisms for both. |
||
{ | ||
private IServiceProvider _backupServiceProvider; | ||
private Dictionary<Type, object> _localServices = new Dictionary<Type, object>(); | ||
|
||
public ServiceProvider([CanBeNull]IServiceProvider backupServiceProvider) | ||
{ | ||
_backupServiceProvider = backupServiceProvider; | ||
} | ||
|
||
public void AddService(Type type, object service) | ||
{ | ||
_localServices.Add(type, service); | ||
} | ||
|
||
public object GetService(Type serviceType) | ||
{ | ||
object service; | ||
if (_localServices.TryGetValue(serviceType, out service)) | ||
{ | ||
return service; | ||
} | ||
|
||
if (_backupServiceProvider != null) | ||
{ | ||
return _backupServiceProvider.GetService(serviceType); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,21 @@ public virtual IndentedStringBuilder AppendLine([NotNull] object o) | |
return this; | ||
} | ||
|
||
public virtual IndentedStringBuilder IncrementIndent() | ||
{ | ||
_indent++; | ||
return this; | ||
} | ||
|
||
public virtual IndentedStringBuilder DecrementIndent() | ||
{ | ||
if (_indent > 0) | ||
{ | ||
_indent--; | ||
} | ||
return this; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
public virtual IDisposable Indent() | ||
{ | ||
return new Indenter(this); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably add a
DatabaseTool
class and do this in the constructor the same way asMigrationTool
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I hadn't bothered since the class (unlike
MigrationTool
) would only have one method, but I can do that. Would probably call itReverseEngineeringTool
though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking it could contain other commands that involve pointing to a database with no context. One example we've talked about is a command to drop the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.